Skip to content

Compact string notation for subplot_mosaic #18731

Closed
@timhoffm

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions