Question about the +r option in the region argument (Mollweide projection)

Hi everyone,

I’m working on plotting a map of the North Sea using the Mollweide projection, and this code works perfectly for generating a map:

import pygmt

fig = pygmt.Figure()

fig.basemap(projection='W15c', region='-5/11/50/62', frame='a')

fig.coast(
    shorelines="1/0.5p",
    borders=["1/thick,black", "2/thin,black@40"],
    water="lightblue",
    land="whitesmoke", frame="g")

fig.show()

This generates the following figure:

However, I’m aiming to have the borders straight (not inclined due to the projection). I assumed that using the +r option in the region argument would make the borders straight while keeping the gridlines inclined. But when I try this, I get the following result:

This is the code for replication:

import pygmt

fig = pygmt.Figure()

fig.basemap(projection='W15c', region='-5/11/50/62', frame='a')

fig.coast(
    shorelines="1/0.5p",
    borders=["1/thick,black", "2/thin,black@40"],
    water="lightblue",
    land="whitesmoke", frame="g")

fig.show()

Although the borders are straight, the region expanded significantly, affecting the visualization that was supposed to focus on the North Sea.

Has anyone encountered this issue or know how to make the borders straight while using the Mollweide projection?

Thanks in advance!

Giving the projection and region to mapproject -WE (see also mapproject docs) should give you a new region that you can use, I think. Don’t know how to do this with python, though:

$ gmt mapproject -JW15c -R-5/11/50/62 -WE
-R-5/50.00000000521209/12.76194543190002/62.00000001012948+r
$ gmt coast -JW15c -R-5/50.00000000521209/12.76194543190002/62.00000001012948+r -png test -W -Bafg

Remember that when you specify +r, the -R defines the lower left and upper right corner of the map. And that’s what you got when you used +r in your example. Just look at your map; the lower left corner is at 5W,11N and the upper right corner is at E50,N62.

@Andreas Exactly what I needed, thank you.