Skip to content

Sharing axes labels goes wrong for twinned axes. #233

Open
@cvanelteren

Description

@cvanelteren

First addresses in #232.

For non-twinned axes the labeling is shared; meaning for a grid we get an expected label on the left for sharing labels above or equal to one. For shared labels this does not occur.

For sharing level "all", the last plot get the ylabel but none are spawned.
For sharing level "labels" the label is copied from the axis it is shared from.

Expectation

The labels should behave similarly to how the non-twinned subplots behave, with the axes being shared. According to the docs, the properties are copied from the sharing axis. I can confirm that this is correctly done. Not sure how trivial this would be to implement since the sharing will make the determination more complex. We could use the _get_border_axes function to determine where to put the labels.

snippet
import ultraplot as uplt, numpy as np, pandas as pd

df = pd.DataFrame(np.random.rand(10, 2), columns=["a", "b"])
layout = [[1, 2], [3, 4]]
fig, axs = uplt.subplots(layout, share="all")
for axi in axs:
    alt = axi.alty()
    axi.plot(x="a", y="b", data=df)
    alt.plot(x="a", y="b", data=df)
uplt.show(block=1)

Problem plots

share labels

Image

share all

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions