How to set the annotation of X axis as Latitude when I use oblique projection

Hello guys,

I would like to plot a gravity map using oblique projection and would like to show the annotation of X axis as latitude. But the annotation of X axis always shows longitude (see attached figure please). How could I change that? It worked well when I used GMT6.0. Now I am using GMT6.5. Many thanks!

Please share script. If it worked with 6.0 it should work with 6.5 as well.

Hi Andreas, thanks. I used:
gmt grdimage Gravity.grd -CGravity.cpt -JOb168/51/172/32.5/14c -R-500/2300/-400/400+uk -BeNsW -Bxa5f1 -Bya5f1

and who can reproduce this?

I am so sorry!

The script is:

makecpt -Cjet -T-200/250 > Gravity.cpt
gmt begin Gravity png
gmt basemap -JOb168/51/172/32.5/14c -R-500/2300/-400/400+uk -BeNsW -Bxa5f1 -Bya5f1
gmt grdimage @earth_faa_01m -CGravity.cpt
gmt end show

Many thanks!

Hello @GEOS,

as already mentioned your code example can not be reproduced as we do not have your gravity data and cpt. Thus, I am using the Earth relief data from the GMT remote datasets in my examples.

I am not sure if I get your questions correctly, but for me it sounds like the map should be rotated by 90°, which can be achieved by -p, i.e., from

gmt begin lon_lat
    gmt grdimage @earth_relief -JOb168/51/172/32.5/14c -R-500/2300/-400/400+uk -BeNsW -Bxa5f1 -Bya5f1
gmt end

to (alternatively -p270/90)

gmt begin lat_lon
    gmt grdimage @earth_relief -JOb168/51/172/32.5/14c -R-500/2300/-400/400+uk -BeNsW -Bxa5f1 -Bya5f1 -p90/90
gmt end

I’m afraid something broke in time.

gmt basemap -JOb168/51/172/32.5/14c -R-500/2300/-400/400+uk -BeNsW -Bxa5f1 -Bya5f1 -png lixo



Hi @Joaquim ,

Thanks. I plotted the required map using GMT6.0, but I could not construct it using GMT6.5. So I posted it in case it is a bug.

Hello @yvonnefroehlich ,

Many thanks for you suggestion.

+v kind of makes the frame working on gmt 6.5.0. Not sure this is useful, but anyway:

gmt grdimage @earth_relief -JOb168/51/172/32.5/4c+v -R-500/2300/-400/400+uk \
-BeNsW -Bxa5f1 -Bya5f1 -png quick --MAP_FRAME_TYPE=plain

Dear all, I misunderstood this issue :slightly_frowning_face:.
As I did not know this study area in more detail, I did not get that the annotations set by GMT are mixed up regarding the West-East and South-North directions!
I thought the whole plot should be rotated and assumed the annotations to be correct.

Interestingly, the annotations are correct when using +v as suggested by @mkononets.

As it is reported that it worked with GMT 6.1, I feel @Joaquim is correct, that something broke over time and needs a fix on the GMT side…

@GEOS Maybe using both +v and -p270/90 is a workaround and produces the desired plot:

gmt begin lat_lon_v
    gmt grdimage @earth_relief -JOb168/51/172/32.5/14c+v -R-500/2300/-400/400+uk -Ggray -BeNsW -Bxa5f1 -Bya5f1 -p270/90
gmt end

Hi @yvonnefroehlich and @mkononets ,

Many thanks for the workaround. It works well.

explicitly specifying --MAP_ANNOT_OBLIQUE=anywhere seems solving the map frame annotation placement issue in gmt 6.5.0:

gmt basemap -JOb168/51/172/32.5/14c -R-500/2300/-400/400+uk -BeNsW -Bxa5f1 -Bya5f1 -png quick --MAP_FRAME_TYPE=plain --MAP_ANNOT_OBLIQUE=anywhere

the documentation says it should be there as a default gmt.conf — GMT 6.5.0 documentation but somehow this was not the case

I did not understand the problem either until @Joaquim posted the frames

Nice job! Many thanks!

Nice finding. We must capture all this in an issue.

@Joaquim Find another issue with the font of annotation of colorbars:

I tried to set the font larger but it did not work (in GMT6.5):

gmt set FONT 12,Times-Roman
gmt set MAP_ANNOT_OBLIQUE anywhere

gmt begin gravity png
gmt grdimage @earth_faa_01m -JOb168/51/172/32.5/14c -R-500/2300/-400/400+uk -BeNsW -Bxa5f1 -Bya5f1
gmt colorbar -C -Dx14.2c/2c+jML+w3c/0.2c+mc -Ba100f50 -By+lmGal
gmt colorbar -C -Dx7c/-0.2c+jTC+w6c/0.2c+mc+h -Ba100f50 -By+lmGal
gmt end show

It works well in GMT 6.4…

@GEOS can you please open a new topic for this issue, so that we can focus on the annotation issue for oblique projections in this topic.

I can try to write such an issue on GitHub in the GMT repository.

I just looked at the example we have in the PyGMT documentation at Oblique Mercator, 2: two points — PyGMT. Here, using +v leads to wrong annotations.

gmt coast -JOb130/35/25/35/6c -R130/35/145/40+r -Ggray -BWSNE -Bxa5f1g5 -Bya2f1g2 -png lon_lat_02

gmt coast -JOb130/35/25/35/6c+v -R130/35/145/40+r -Ggray -BWSNE -Bxa5f1g5 -Bya2f1g2 -png lon_lat_v_02

gmt coast -JOb130/35/25/35/6c -R130/35/145/40+r -Ggray -BWSNE -Bxa5f1g5 -Bya2f1g2 --MAP_ANNOT_OBLIQUE=anywhere -png lon_lat_anywhere_02

gmt coast -JOb130/35/25/35/6c+v -R130/35/145/40+r -Ggray -BWSNE -Bxa5f1g5 -Bya2f1g2 --MAP_ANNOT_OBLIQUE=anywhere -png lon_lat_v_anywhere_02

Edit 2024/03/28: Opened an issue at Oblique projection (Ob): Partly wrong annotations · Issue #8418 · GenericMappingTools/gmt · GitHub.

Hi @yvonnefroehlich ,
New topic created. Thanks.

some more re. the funny tick and annotation placement

--MAP_ANNOT_OBLIQUE=anywhere actually produces many extra ticks w/o annotations not visible until the ticks are drawn long enough --MAP_TICK_LENGTH_PRIMARY=20p/10p:

gmt basemap -JOb168/51/172/32.5/14c -R-500/2300/-400/400+uk -BWesN -Bxa5f1g5 -Bya5f1g5 --MAP_FRAME_PEN=auto,red --MAP_TICK_LENGTH_PRIMARY=20p/10p --MAP_GRID_PEN=auto,grey --MAP_ANNOT_OBLIQUE=anywhere -png quick

here all ticks and labels as expected, using --MAP_ANNOT_OBLIQUE=anywhere,tick_extend:

gmt basemap -JOb168/51/172/32.5/14c -R-500/2300/-400/400+uk -BWesN -Bxa5f1g5 -Bya5f1g5 --MAP_FRAME_PEN=auto,red --MAP_TICK_LENGTH_PRIMARY=20p/10p --MAP_GRID_PEN=auto,grey --MAP_ANNOT_OBLIQUE=anywhere,tick_extend -png quick

the original tick placement, gmtdefaults says MAP_ANNOT_OBLIQUE is separate,lon_horizontal,lat_horizontal,tick_extend, ticks missing, tick annotations “far away” as specified by --MAP_TICK_LENGTH_PRIMARY and tick_extend:

gmt basemap -JOb168/51/172/32.5/14c -R-500/2300/-400/400+uk -BWesN -Bxa5f1g5 -Bya5f1g5 --MAP_FRAME_PEN=auto,red --MAP_TICK_LENGTH_PRIMARY=20p/10p --MAP_GRID_PEN=auto,grey -png quick

as above, but without tick_extend:

gmt basemap -JOb168/51/172/32.5/14c -R-500/2300/-400/400+uk -BWesN -Bxa5f1g5 -Bya5f1g5 --MAP_FRAME_PEN=auto,red --MAP_TICK_LENGTH_PRIMARY=20p/10p --MAP_GRID_PEN=auto,grey --MAP_ANNOT_OBLIQUE=separate,lon_horizontal,lat_horizontal -png quick


gmt basemap -JOb168/51/172/32.5/14c -R-500/2300/-400/400+uk -BWesN -Bxa5f1g5 -Bya5f1g5 --MAP_FRAME_PEN=auto,red --MAP_TICK_LENGTH_PRIMARY=20p/10p --MAP_GRID_PEN=auto,grey --MAP_ANNOT_OBLIQUE=separate,lon_horizontal -png quick

--MAP_ANNOT_OBLIQUE=separate,lat_horizontal, longitude annotations (175 E) is missing:

gmt basemap -JOb168/51/172/32.5/14c -R-500/2300/-400/400+uk -BWesN -Bxa5f1g5 -Bya5f1g5 --MAP_FRAME_PEN=auto,red --MAP_TICK_LENGTH_PRIMARY=20p/10p --MAP_GRID_PEN=auto,grey --MAP_ANNOT_OBLIQUE=separate,lat_horizontal -png quick