Rehman
September 18, 2023, 5:31pm
1
I want to add a scale to a map. I have tried the example given in the online sources (using pscoast with the -L option, but am unable to create it. By running the below script, I can only get the map, but not the scale.
#!/bin/bash
LATLON=18/125/-70/25
PROJ=M6i
FNAME=map.ps
gmt grdimage ./earth_relief_15s.grd -R${LATLON} -J${PROJ} -I -X2 -Y3 -n+c -C./ciob.cpt -P -B15 -V -K >${FNAME}
gmt pscoast -R${LATLON} -J${PROJ} -O -K -Dh -Gc >> ${FNAME}
gmt grdimage ./earth_relief_15s.grd -R${LATLON} -J${PROJ} -Cgray.cpt -O -K >> ${FNAME}
gmt pscoast -R${LATLON} -J${PROJ} -Lg110/-68+c5+w1000k+f+ab -O -K -Q >> ${FNAME}
gmt psscale -C./ciob.cpt -D7.7/-1.0/15/0.4h -P -O -B1000:“Bathymetry”:/:meter: -I -V >> ${FNAME}
Rehman:
-Lg110/-68
These are the coordinates where the scale is located. I suspect that they are outside your map. Try modifying them.
Rehman
September 18, 2023, 5:58pm
3
Plot region is R is 18/125/-70/25
Mm, ok. Could you share your map?
Joaquim
September 18, 2023, 6:20pm
5
Rehman:
gmt grdimage ./earth_relief_15s.grd -R${LATLON} -J${PROJ} -I -X2 -Y3 -n+c -C./ciob.cpt -P -B15 -V -K >${FNAME}
gmt pscoast -R${LATLON} -J${PROJ} -O -K -Dh -Gc >> ${FNAME}
The above gets erased by following commands
gmt grdimage ./earth_relief_15s.grd -R${LATLON} -J${PROJ} -Cgray.cpt -O -K >> ${FNAME}
gmt pscoast -R${LATLON} -J${PROJ} -Lg110/-68+c5+w1000k+f+ab -O -K -Q >> ${FNAME}
gmt psscale -C./ciob.cpt -D7.7/-1.0/15/0.4h -P -O -B1000:“Bathymetry”:/:meter: -I -V >> ${FNAME}
Please, post reproducible code.
Rehman
September 18, 2023, 6:40pm
7
I have edited the question and included projection and region information. You have erased some commends, I have to mention here, for land part I have used gray.cpt and for oceanic region I have used ciob.cpt.
Joaquim
September 18, 2023, 6:58pm
8
I have not erased anything. Just called to attention that a call to grdimage
overlaps everything that was plotted before.
Note, you can reduce your case to a single call to psbasemap
.
Rehman
September 18, 2023, 7:40pm
10
So, I have to use one cpt file to not recall grdimage that overlaps everything.
I there any way to plot the land part with grey and the oceanic region with haxby? As shown in above attached Map.
I am not sure how -Q interacts with -Lg. Try this instead:
gmt pscoast -O -K -Q >> ${FNAME}
gmt psbasemap -R${LATLON} -J${PROJ} -Lg110/-68+c5+w1000k+f+ab -O -K >> ${FNAME}
pwessel
September 18, 2023, 7:52pm
12
See gallery example 17 or so (India).
Rehman
September 18, 2023, 8:06pm
13
I have generated a map attached above following example 17. Only my problem with Map scale (using option pscoast -L), not appearing on Map.
Rehman
September 18, 2023, 8:07pm
14
Ok, It’s working. I want you to do a small edit write gmt psbasemap in place of basemap
Thank you GMT community.