How can I change the direction of the y-axis labels in my PyGMT map?

Hi everyone,

I wanted to rotate the y-axis labels direction (i.e., 90 or -90 degrees) of my map which I created using PyGMT. A breif snippet of the code is shown below:

fig = pygmt.Figure()
pygmt.makecpt(cmap='gray', 
              series='300/7000/1', 
              continuous=True, transparency=50)

with pygmt.config(MAP_FRAME_TYPE = 'plain'):
    fig.grdimage(region = risreg, projection = risproj, frame=["a", "xf100000", "yf100000", "xaf+lEasting [m]", "yaf+lNorthing [m]"], 
                 grid = grid, shading=True, transparency=30, nan_transparent=True)

# RGI glacier outlines
fig.plot(data=rgi, pen="0.01p,mediumblue,-", color="mediumblue", transparency=50)

This code produces a map, below for your reference:

Now, I am not able to change the directions of the y-axis labels (Northings), which I want to orient vertically to save the space and make the map a bit bigger.

Any help or suggestions would be highly appreciated.

Thank you.

Hi,

have you tried pygmt.config(MAP_ANNOT_OBLIQUE="lat_parallel") based on How rotate coordinates labels in Pygmt?

For your Cartesian frame you might need to use MAP_ANNOT_ORTHO.

2 Likes

Dear Fabian,

Thanks for the reply and suggestion. It worked nicely.