Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bad xlim/ylim when using shared axes subplots and an empty subplot #2356

Closed
@ChrisBeaumont

Description

@ChrisBeaumont

The following code

fig, axes = plt.subplots(nrows=1, ncols=2, sharex=True, sharey=True)
axes[0].plot([1,2,3])
print axes[0].get_xlim(), axes[0].get_ylim()
plt.show()

outputs

(-0.059999999999999998, 0.059999999999999998) (-0.059999999999999998, 0.059999999999999998)

The axis limits are only updated to sane values once the second axes is populated with something.

If a subplot with shared axes is empty, I expect the view limits to be set according to the non-empty plots

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