Increase white space between axis label & outer frame

Hi All,

fig1 = pygmt.Figure()
with fig1.subplot(
    nrows=4,
    ncols=1,
    figsize=("15c", "12c"),  
    clearance="0c",
    title="My Subplot Heading",
    sharex='t'
):
    fig1.basemap(region=[0, 10, 0, 10], projection="X?", panel=[0, 0])    
    fig1.basemap(region=[0, 20, 0, 10], projection="X?", panel=[1, 0])
    fig1.basemap(region=[0, 10, 0, 20], projection="X?", panel=[2, 0])
    fig1.basemap(region=[0, 20, 0, 20], projection="X?", panel=[3, 0])   
 
fig1.show()

How can I increase the white space between the y-axis label and outer frame of the plot?

Thank you

Hello @Idontknow_007,

Welcome to the GMT forum :slightly_smiling_face:.

Hm. Can you please specify what you mean with

y-axis label and outer frame of the plot

Maybe looking at the GMT default parameters can help you. Maybe MAP_HEADING_OFFSET or MAP_ANNOT_OFFSET are suitable here?

import pygmt 

fig1 = pygmt.Figure()

pygmt.config(
    MAP_HEADING_OFFSET="50p",
    MAP_ANNOT_OFFSET="20p",
)

with fig1.subplot(
    nrows=4,
    ncols=1,
    figsize=("15c", "12c"),  
    clearance="0c",
    title="My Subplot Heading",
    sharex='t'
):
    fig1.basemap(region=[0, 10, 0, 10], projection="X?", panel=[0, 0])    
    fig1.basemap(region=[0, 20, 0, 10], projection="X?", panel=[1, 0])
    fig1.basemap(region=[0, 10, 0, 20], projection="X?", panel=[2, 0])
    fig1.basemap(region=[0, 20, 0, 20], projection="X?", panel=[3, 0])   
 
fig1.show()

@yvonnefroehlich thank you for your response.

In the attached plot of yours, I want to increase gap/space between y axis label and outer edge of the plot. This has ~0 cm gap, I wanted to have around 1 cm.

Thank you

Ah, you want a white margin around your plot? Something like:

Hm, I am not sure if there is direct / elegant way to accomplish this.

resize parameter of pygmt’s Figure.savefig or Figure.psconvert can add margins. Documentation: pygmt.Figure.savefig, pygmt.Figure.psconvert

fig1.savefig('whitespace_margins.png', show=True, resize='+m1c') adds 1 cm on all sides.

1 Like

Thank you @mkononets

That’s nice, @mkononets :slightly_smiling_face: I was actually not aware of this option!