Skip to content

Overview of Axes creation methods #17376

@timhoffm

Description

@timhoffm

We should have an overview (possibly in the tutorials) which methods create Axes and when to use which.

This could contain the flow-chart blow plus additional descriptions.

  • I've not taken into account subgridspec and axes_grid1.
  • Am I missing some methods?
  • the diagram could be embedded using .. graphviz. However, while it renders with http://graphviz.it/ it currently does not with sphinx (issueing some errors).
  • The styling could still be improved (add links, font/color, use a HTML node instead of a record, ...)

grafik

digraph {
    node[shape=diamond]
        q_fullsize; q_simple_grid; q_complex_grid; q_inset; q_twin;
    node[shape=record]
        full_size;
       
    q_fullsize [label="full size?"]
    full_size [label="{plt.subplot()|plt.subplots()} | {Figure.add_subplot()|Figure.subplots()}"]
    q_simple_grid [label="simple grid?"]
    simple_grid [label="{plt.subplot(n, m, k) | plt.subplots(n, m)}| {Figure.add_subplot(n, m, k) | Figure.subplots(n, m)}"]
    q_complex_grid [label="complex grid?"]
    complex_grid [label="{plt.subplot2grid() | plt.subplot(subplotspec) | plt.subplots(gridspec_kw) | } | { | Figure.subplot(subplotspec) | Figure.subplots(gridspec_kw) | GridSpec.subplots()}"]
    q_inset [label="inset?"]
    inset [label="Axes.inset_axes()"]
    q_twin [label="twin?"]
    twin [label="{plt.twinx() | plt.twiny()} | {Axes.twinx() | Axes.twiny()}"]
    axes [label="{plt.axes() | Figure.add_axes()}"]

    q_fullsize -> q_simple_grid [ label = "No" ];
    q_simple_grid -> q_complex_grid [label = "No" ];
    q_fullsize -> full_size [ label = "Yes" ];
    q_simple_grid -> simple_grid[ label = "Yes" ];
    q_complex_grid -> complex_grid [label = "Yes"];
    q_complex_grid -> q_inset [label = "No"];
    q_inset -> inset[label="Yes"];
    q_inset -> q_twin [label="No"]
    q_twin -> twin[label="Yes"]
    q_twin -> axes[label="No"]

    {
        rank=same;
        q_fullsize full_size
    }
    {
        rank=same;
        q_simple_grid simple_grid
    }
    {
        rank=same;
        q_complex_grid complex_grid
    }
    {
        rank=same;
        q_inset inset
    }
    {
        rank=same;
        q_twin twin
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationkeepItems to be ignored by the “Stale” Github Action

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions