Compact string notation for subplot_mosaic · Issue #18731 · matplotlib/matplotlib · GitHub
Skip to content

Compact string notation for subplot_mosaic #18731

Description

@timhoffm

Instead of

plt.subplot_mosaic(
    """
    AB
    CC
    """)

should we also allow a short string version

plt.subplot_mosaic("AB|CC")

?

Implementing is probably as simple as:

if '|' in layout and not '\n' in layout:
    layout = layout.replace('|', '\n')

to get back to the long version.

I got the idea while trying to find a compact replacement for the plot in https://matplotlib.org/devdocs/gallery/subplots_axes_and_figures/axes_margins.html.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions