Skip to content

Error adding rowlabels for custom gridspec #375

@Holmgren825

Description

@Holmgren825

Hey!
Will begin by thanking you for continuing the work with ultraplot!

I've encountered what I think is an error with the formatting of row labels using a custom gridspec. If the first column of a row is empty, the row does not seem to count. Here is a minimal example:

import ultraplot as plt
gridspec = [
    [1, 1, 2, 2],
    [0, 3, 3, 0],
    [4, 4, 5, 5],
]

fig, ax = plt.subplots(
    gridspec,
)
ax.format(rowlabels=["1", "2", "3"])

which raises an error: ValueError: Got 3 left labels but found 2 axes along the left side of the figure.

If I add a plot to the first column of the 2nd row, things works as expected.

gridspec = [
    [1, 1, 2, 2],
    [6, 3, 3, 0],
    [4, 4, 5, 5],
]

fig, ax = plt.subplots(
    gridspec,
)
ax.format(rowlabels=["1", "2", "3"])

produces

Image

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions