Plotting map of Hawaii with text

Im having trouble plotting Hawaii while also including text at the top and bottom without causing the state to be “squished”. What am I doing wrong?

I have adjusted the region bounds but that does not seem to help. I only have basic knowledge of GMT but it seems like there is a simple solution. Any help is appreciated.

Im using GMT6.4.0

Without the text

#!/bin/csh

setenv region -Rg-159.8/-154.7/18/23
setenv projection "-Jx2.5"
setenv pagecolor 148/148/148
gmt psxy $region $projection --PS_MEDIA=a4 --PS_PAGE_COLOR=148/148/148 $polyfile -W0.4p,0/0/0 -K > $outfile.ps
gmt psxy $projection $region $polyfile -W0.4p,0/0/0 -Glightbrown -O >> $outfile.ps
convert -trim -flatten -density 300 -rotate 90 -geometry 650x475! +repage $outfile.ps $outfile.png

With the text

#!/bin/csh

setenv region -Rg-159.8/-154.7/18/23
setenv projection "-Jx2.5"
setenv pagecolor 148/148/148
gmt psxy $region $projection --PS_MEDIA=a4 --PS_PAGE_COLOR=148/148/148 $polyfile -W0.4p,0/0/0 -K > $outfile.ps
gmt psxy $projection $region $polyfile -W0.4p,0/0/0 -Glightbrown -O >> $outfile.ps
echo "-157.5 22.5 TOP" | gmt pstext $region $projection -F+f11p,21 -N -O -K >> $outfile.ps
echo "-157.5 18.5 BOTTOM" | gmt pstext $region $projection -F+f11p,21 -N -O >> $outfile.ps
convert -trim -flatten -density 300 -rotate 90 -geometry 650x475! +repage $outfile.ps $outfile.png

test

test-topbottom

Don’t use convert (I don’t know what it is doing. Use psconvert and add a -Ba to see the coordinates where text is being placed.

This is not good either. Drop the ‘g’

pstext also expects to be told the text angle and justification
use eg -F+a0+jTC
or pipe them to pstext as the third and fourth column and use -F+a+j

convert is part of imagemagick

not according to the docs, unless +a and +j are present as part of -F but without an angle and justification specification.

angle is probably not needed here, but +j and +c help with text placement that is like “top center” or “bottom left” and even +t. like:

gmt pstext -R-159.8/-154.7/18/23 -Jx2.5 -F+cBC+jTC+f11p,21+tBOTTOM -Dj0.1c -Bltrb -P -N > outfile.ps
gmt psconvert outfile.ps -Tg -A

-F+cBC+jBC is for label placement inside the frame (drawn just for illustration), +cBC+jTC places the label outside the frame so -N must be present in this case. -Dj adds offset from so the label does not overlap with the frame if there is one. -P enables portrait orientation, so no need to rotate the map afterwards.

Thanks for the tips! The imagemagick convert was causing the distortion issue.
I was able to get a proper image using

gmt psconvert $outfile.ps -A -I+s10c -Tg

However, the geometry of the image needs to be 650x475.
Its currently 1536x1479

I do not see an specific examples in the help pages or anywhere else on how to do this but it seems I need to use either the -A or -I option in psconvert. Any suggestions on how to get the desired geometry?

GMT figures use physical dimensions, not pixels. You may make computations using the -E or -I+S options to get the desired size in pixels. Or use an external program to do that resizing.

well topic starter started with using imagemagick’s convert in the topic

except that imagemagick needs to be configured to preserve aspect ratio and to fill in margins as needed.