Add a Map Scale to a Map

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.

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}

These are the coordinates where the scale is located. I suspect that they are outside your map. Try modifying them.

Plot region is R is 18/125/-70/25

Mm, ok. Could you share your map?

Please, post reproducible code.


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.

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.

OK, I understand.

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}

See gallery example 17 or so (India).

I have generated a map attached above following example 17. Only my problem with Map scale (using option pscoast -L), not appearing on Map.

Ok, It’s working. I want you to do a small edit write gmt psbasemap in place of basemap
Thank you GMT community.