# Y-axis label clipped when ticks are too big

**URL:** <https://forum.generic-mapping-tools.org/t/y-axis-label-clipped-when-ticks-are-too-big/3072>\
**Category:** PyGMT Q&A\
**Created:** [June 28, 2022, 6:52pm UTC](https://forum.generic-mapping-tools.org/t/y-axis-label-clipped-when-ticks-are-too-big/3072 "2022-06-28T18:52:14Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![lenhofed](https://avatars.discourse-cdn.com/v4/letter/l/7feea3/32.png) [@lenhofed](https://forum.generic-mapping-tools.org/u/lenhofed)\
**Post date:** [June 28, 2022, 6:52pm UTC](https://forum.generic-mapping-tools.org/t/y-axis-label-clipped-when-ticks-are-too-big/3072/1 "2022-06-28T18:52:14Z")

</div>

Hello everyone

I am trying to make a subplot with big and readable axis labels and ticks for a presentation.  
So I modified the font size but now the y-axis label is outside the figure (see example figure).  
Would you have any workaround to correct that ? The even better possibility would be to align the y labels but that is of second order of priority.

The code used to produce the figure is as follows :

```
a = np.arange(0,1000)
b = np.random.normal(15000, 1000, a.size)
c = np.random.normal(-15000, 1000, a.size)
fig = pygmt.Figure()
with pygmt.config(FONT_ANNOT=16, FONT_LABEL=18):
with fig.subplot(
        nrows=2, ncols=1, figsize=("15c", "10c"), margins="0.5c",
):
with fig.set_panel(panel=0):
    fig.basemap(projection="X?", region=[np.min(a), np.max(a), np.min(b), np.max(b)],
                frame=['xaf+l"A in some units"', 'yaf+l"B in some units"'])
    fig.plot(x=a, y=b)

    with fig.set_panel(panel=1):
        fig.basemap(projection="X?", region=[np.min(a), np.max(a), np.min(c), np.max(c)],
                    frame=['xaf+l"A in some units"', 'yaf+l"C in some units"'])
        fig.plot(x=a, y=c)

fig.show() 

```

Have a nice day !!

[example.pdf](https://forum.generic-mapping-tools.org/uploads/short-url/zhUym3LZjjcJnsTQV7NO8SSXp0u.pdf) (15.2 KB)

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [June 28, 2022, 7:10pm UTC](https://forum.generic-mapping-tools.org/t/y-axis-label-clipped-when-ticks-are-too-big/3072/2 "2022-06-28T19:10:15Z")

</div>

Smells of bad ghostscript. What is your ghostscript version?

---

<div class="post-metadata">

**Author:** ![lenhofed](https://avatars.discourse-cdn.com/v4/letter/l/7feea3/32.png) [@lenhofed](https://forum.generic-mapping-tools.org/u/lenhofed)\
**Post date:** [June 29, 2022, 9:18am UTC](https://forum.generic-mapping-tools.org/t/y-axis-label-clipped-when-ticks-are-too-big/3072/3 "2022-06-29T09:18:16Z")

</div>

It is v9.50

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [June 29, 2022, 9:41am UTC](https://forum.generic-mapping-tools.org/t/y-axis-label-clipped-when-ticks-are-too-big/3072/4 "2022-06-29T09:41:22Z")

</div>

The simplest check would be to update gs to the current version. I think 9.56 is the latest but most distros will have 9.55. We did have this but with some of the earlier gs versions, cannot recall if 9.50 was one of them but very likely.

---

<div class="post-metadata">

**Author:** ![lenhofed](https://avatars.discourse-cdn.com/v4/letter/l/7feea3/32.png) [@lenhofed](https://forum.generic-mapping-tools.org/u/lenhofed)\
**Post date:** [June 29, 2022, 12:44pm UTC](https://forum.generic-mapping-tools.org/t/y-axis-label-clipped-when-ticks-are-too-big/3072/5 "2022-06-29T12:44:37Z")

</div>

Dear @pwessel

I could update my ghostscript version to v9.55.0 and v9.56.1  
But the problem still persists for both versions.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [June 29, 2022, 1:01pm UTC](https://forum.generic-mapping-tools.org/t/y-axis-label-clipped-when-ticks-are-too-big/3072/6 "2022-06-29T13:01:18Z")

</div>

Oh well, worth a try. Hopefully one of the pyGMT developers can comment further.

---

<div class="post-metadata">

**Author:** ![seisman](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/seisman/32/4_2.png) [@seisman](https://forum.generic-mapping-tools.org/u/seisman)\
**Post date:** [July 1, 2022, 1:13am UTC](https://forum.generic-mapping-tools.org/t/y-axis-label-clipped-when-ticks-are-too-big/3072/7 "2022-07-01T01:13:32Z")

</div>

I can reproduce the issue using GMT CLI. Here is a minimal script:

```auto
gmt begin map
  gmt set FONT_ANNOT=16 FONT_LABEL=18
  gmt subplot begin 2x1 -Ff15c/10c -M0.5c
    gmt basemap -JX? -R0/1000/12000/18000 -Bxaf+l"A in some units" -Byaf+l"B in some units" -c0
    gmt basemap -JX? -R0/1000/-18000/12000 -Bxaf+l"A in some units" -Byaf+l"B in some units" -c1
  gmt subplot end
gmt end show

```

I’m using GMT `6.5.0_548903e_2022.06.27` and gs 9.55.0 on Linux.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [July 1, 2022, 8:25am UTC](https://forum.generic-mapping-tools.org/t/y-axis-label-clipped-when-ticks-are-too-big/3072/8 "2022-07-01T08:25:29Z")

</div>

Intercepting the hidden gmt\_o.ps- in the session dir before it completes shows it only moves the origin in to 1in, 1in. What happen to our **GMT\_PAPER\_MARGIN\_AUTO** of 40 inches? If I make the edit and move the origin as intended then the rest works.

Will look at this later - have an all day event (seminar + dinner) today.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [July 1, 2022, 8:28am UTC](https://forum.generic-mapping-tools.org/t/y-axis-label-clipped-when-ticks-are-too-big/3072/9 "2022-07-01T08:28:21Z")

</div>

Somehow this gets set to the FIXED value:

```
	double paper_margin = GMT_PAPER_MARGIN_AUTO;

	if (gmtlib_fixed_paper_size (GMT->parent)) {	/* Must honor paper size and regular margin */
		paper_margin = GMT_PAPER_MARGIN_FIXED;
		gmt_M_memcpy (media_size, GMT->current.setting.ps_def_page_size, 2, double);
	}
```

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [July 3, 2022, 11:51am UTC](https://forum.generic-mapping-tools.org/t/y-axis-label-clipped-when-ticks-are-too-big/3072/10 "2022-07-03T11:51:56Z")

</div>

Thanks for pointing this out. Fixed in master repo via this [PR](https://github.com/GenericMappingTools/gmt/pull/6844).

---

<div class="post-metadata">

**Author:** ![lenhofed](https://avatars.discourse-cdn.com/v4/letter/l/7feea3/32.png) [@lenhofed](https://forum.generic-mapping-tools.org/u/lenhofed)\
**Post date:** [July 11, 2022, 9:27pm UTC](https://forum.generic-mapping-tools.org/t/y-axis-label-clipped-when-ticks-are-too-big/3072/11 "2022-07-11T21:27:38Z")

</div>

Dear @pwessel

Thank you very much for the support. I will try to reinstall soon the latest version from github in order to give you a (second) confirmation that the fix works.

Best regards
