I have some plots which are Cartesian grdcontour() plots, where the x-axis is longitude, and the y-axis is depth. The longitudes are negative, and labelled as such (e.g, -51.0, -50.5 etc), but I’d like them to be formatted to be 51°W, 50.5°W etc.
This obviously happens automatically for the default Figure if plotting a geographic region, but not for Cartesian plots. Is there anyway to do this in PyGMT?
I don’t know PyGMT, but if it is similar to GMT, that would be within the “projection” sub-object :
projection="X15cd/10c"
where X is cartesian projection, 15c is the width of the figure, d is to specify the nature of x-axis data as “degrees”.
(from GMT doc):
While the Cartesian linear projection is primarily designed for regular floating point �,� data, it is sometimes necessary to plot geographical data in a linear projection. This poses a problem since longitudes have a 360° periodicity. GMT therefore needs to be informed that it has been given geographical coordinates even though a linear transformation has been chosen. We do so by adding a g (for geographical) or d (for degrees) directly after -R or by appending a g or d to the end of the -Jx (or -JX ) option.
My very last question (plot is almost complete!) is if I use a ‘xa0.5’ for a half-degree longitude annotation, I get a ‘47°30’W’ tick label. Is there anyway to change this to be ‘47.5°W’?
This is very much a ‘nice to have’ option, so not a problem if it’s not a simple change.
# https://docs.generic-mapping-tools.org/6.4/gmt.conf.html#term-FORMAT_GEO_MAP
# For details see the table under https://docs.generic-mapping-tools.org/6.4/gmt.conf.html#term-FORMAT_GEO_OUT
pygmt.config(FORMAT_GEO_MAP="ddd.x") # Use as many x as digits