8000 Feature Idea: Make subplots return an AxisList object instead of a numpy array · Issue #9434 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Feature Idea: Make subplots return an AxisList object instead of a numpy array #9434
Closed as not planned
@AKuederle

Description

@AKuederle

Hey,

This is a short idea I had when creating complex graphs with multiple subplots.
Sometimes you want to apply the same actions to multiple subplots and a way that feels very natural would be something like this:

fig, axs = plt.subplots(2, 2)
axs[:, 0].set_ylabel('test')

This does of course not work, but could be easily be achieved by returning a custom object that wraps a list of axes instances and overwrites the __getitem__ method.
Of course it would need to reimplement all axes methods, but it might be possible to do that by just forwarding all call in a modified __getattribute__ or by automatically creating wrapped classmethods in a metaclass.

With such a custom object it might even be possible to support something like this:

axs[:, 0].set_ylabel(['test1', 'test2'])

If there is interest in such functionality, I would try to build a working prototype.

Other than that, thanks to everybody for all the awesome work you put into matplotlib!
Regards,
Arne

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationNew featurestatus: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0