Skip to content

Issue with shared axis labels on geographic axis #234

Closed

Description

@lwq-star

Referencing this conversation #155 , everything works normally, but looping through each subplot to plot causes a bug.

import ultraplot as uplt
import numpy as np

fig, axs = uplt.subplots(ncols=2, nrows=3, span=False, share='all', proj="cyl",
                         journal='nat2')
axs.format(abc=True, abcloc="ul", lonlabels='both', latlabels='both')

Image

This is my example.

import ultraplot as uplt
import numpy as np

fig, axs = uplt.subplots(ncols=2, nrows=3, span=False, share='all', proj="cyl",
                         journal='nat2')
axs.format(abc=True, abcloc="ul", lonlabels='both', latlabels='both')

a = np.random.rand(10, 10) * 2 - 1

for idx in range(6):
    ax = axs[idx]
    m = ax.pcolormesh(a, cmap="viridis")
fig.colorbar(m, label="ac1", ticks=4, loc="r")

Image
There might be some conflicts that have arisen.

Activity

  1. added
    bug
    on May 26, 2025
  2. cvanelteren commented on May 26, 2025

    @cvanelteren
    Collaborator

    The bug is caused by the colorbar I reckon. I think the colorbar somehow interacts with the labels on the geoaxes in particular by adjusting which ticks are on or off depending on the location of the colorbar. For a a singular plot it will also turn them off. PR welcome ;-)

  3. cvanelteren commented on May 26, 2025

    @cvanelteren
    Collaborator

    The colorbar somehow interferes with which labels are turned on or off. When plotting without it, the logic in 748 in the file geo.py correctly shows that the middle plot should have the labels on on the left. When the colorbar is added this never occurs. I suspect there is an interference through colorbar not directly in geo.py

  4. cvanelteren commented on May 26, 2025

    @cvanelteren
    Collaborator

    I think I know what is going on. The _get_border_axes logic does not account for when subpanel are added this creates the odd pattern you observe.

  5. cvanelteren commented on May 27, 2025

    @cvanelteren
    Collaborator

    Think I found a fix for the GeoPart:

    Image

  6. cvanelteren commented on May 30, 2025

    @cvanelteren
    Collaborator

    Need some minor fixes but this will be fixed soon. For users now turn off the sharing and it will work as it worked in the past (I think)

  7. cvanelteren commented on Jun 2, 2025

    @cvanelteren
    Collaborator

    Fixed on main/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions