Skip to content

Feature Idea: Make subplots return an AxisList object instead of a numpy array #9434

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy