%Chapter 2, Fig 2.12
%Eric Dubois, updated 2018-11-08
%Required function: ds2nfu by Michelle Hirsch
clear all
close all

%create the plot
figure

%set region
xlim([-1.2, 1.3]);
ylim([-1.2, 1.3]);

%plot the hexagon
h = sqrt(3)/2;
hex = polyshape([1 .5 -.5 -1 -.5 .5],[0 h h 0 -h -h]);
plot(hex,'Facecolor','white','EdgeColor','black');
set(gca,'ydir','reverse'); 
axis equal
axis off

hold on

%Place axis values
text(1,-.1,'1','FontName','times');
text(-1.05,-.1,'-1','FontName','times');
text(.45,-.1,'0.5','FontName','times');
text(-.55,-.1,'-0.5','FontName','times');
strh = '$$\sqrt{3}/2$$';
text(.03,h+.07,strh,'Interpreter','latex');
strmh = '$$-\sqrt{3}/2$$';
text(.03,-h-.07,strmh,'Interpreter','latex');

%Draw ticks
plot([0.5 0.5],[-.03 .03],'k');
plot([-0.5 -0.5],[-.03 .03],'k');

%create the axes
%x axis from -1.1 to 1.2
[xaxx,xaxy] = ds2nfu([-1.1 1.2], [0 0]);
annotation('arrow',xaxx,xaxy,'headlength',5,'headwidth',5);
%y axis from -1 to 1.08
[yaxx,yaxy] = ds2nfu([0.0 0.0],[.9 -.9]);
annotation('arrow',yaxx,yaxy,'headlength',5,'headwidth',5);
text(1.2,-0.1,'\itx','FontName','times')
text(-0.1, 1.2, '\ity','FontName','times')

set(gca,'FontName','times')          %set the plot font to times
set(gca,'FontSize',8)                %set the plot size to 8pt
set(gcf,'units','centimeters','position',[0.5,0.5,15,15]);
set(gcf,'Color',[1 1 1]);