FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Overview of Axes creation methods · Issue #17376 · matplotlib/matplotlib · GitHub

Repository navigation

Overview of Axes creation methods #17376

Open

Description

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, ...)

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
    }
}

Activity

  1. ianhi commented on May 10, 2020

    Contributor

    This would be great! I've always been a bit overwhelmed by this.

    possibly in the tutorials

    👍

    Am I missing some methods?

    I think you're missing Figure.gca() which will create an axis if one doesn't exist. https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.gca

    Suggestions:

    • Are there any methods to create axes that shouldn't be used? If so it would great to have this communicated.
    • It would also be great to have some substructure at each level to avoid choice paralysis. Something like highlighting one in green for each box of methods as the first thing someone should consider.
    • How about providing some basic imagery demonstrating the types of layouts being made on each level. Even just some arrays of squares with ellipses.
  2. YonghuiWang99 commented on May 10, 2020

    I am just learning matplotlib through the tutorials. The overview helps me to understand more about the creative logic. Understanding improve skill of application, I believe. So thank you.

    In addition, do you think if it is possible to add general concepts which I could find in version 3.1.0 in the current released version (version 3.2.1) ? I think it is also important to understand the creative logic as well.

    https://matplotlib.org/3.1.0/tutorials/introductory/usage.html

  3. pinned this issue on May 26, 2020
  4. unpinned this issue on May 26, 2020
  5. timhoffm commented on Aug 29, 2021

    MemberAuthor
    • added subplot_mosaic
    • style updates

    digraph {
        node[shape=diamond, width=2.7, height=0.8]
            q_fullsize; q_simple_grid; q_complex_grid; q_inset; q_twin;
        node[shape=none, margin=0]
            full_size;
           
        q_fullsize [label="full size?"]
        full_size [label=<
    <FONT FACE="arial"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="2" CELLPADDING="5">
    <TR><TD BGCOLOR="gray90" ALIGN="left" WIDTH="200">plt.subplot()</TD><TD BGCOLOR="gray90" ALIGN="left" WIDTH="200">Figure.add_subplot()</TD></TR>
    <TR><TD BGCOLOR="gray90" ALIGN="left" WIDTH="200">plt.subplots()</TD><TD BGCOLOR="gray90" ALIGN="left">Figure.subplots()</TD></TR>
    </TABLE></FONT>>]
        q_simple_grid [label="simple grid?"]
        simple_grid [label=<
    <FONT FACE="arial"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="2" CELLPADDING="5">
    <TR><TD BGCOLOR="gray90" ALIGN="left" WIDTH="200">plt.subplot(n, m, k)</TD><TD BGCOLOR="gray90" ALIGN="left" WIDTH="200">Figure.add_subplot(n, m, k)</TD></TR>
    <TR><TD BGCOLOR="gray90" ALIGN="left">plt.subplots(n, m)</TD><TD BGCOLOR="gray90" ALIGN="left">Figure.subplots(n, m)</TD></TR>
    </TABLE></FONT>>]
        q_complex_grid [label="complex grid?"]
        complex_grid [label=<
    <FONT FACE="arial"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="2" CELLPADDING="5">
    <TR><TD BGCOLOR="gray90" ALIGN="left" WIDTH="200">plt.subplot_mosaic()</TD><TD BGCOLOR="gray90" ALIGN="left" WIDTH="200">Figure.subplot_mosaic()</TD></TR>
    <TR><TD BGCOLOR="gray90" ALIGN="left">plt.subplot2grid()</TD><TD BGCOLOR="gray90" ALIGN="left">Figure.subplot(subplotspec)</TD></TR>
    <TR><TD BGCOLOR="gray90" ALIGN="left">plt.subplot(subplotspec)</TD><TD BGCOLOR="gray90" ALIGN="left">Figure.subplots(gridspec_kw)</TD></TR>
    <TR><TD BGCOLOR="gray90" ALIGN="left">plt.subplots(gridspec_kw)</TD><TD BGCOLOR="gray90" ALIGN="left">GridSpec.subplots()</TD></TR>
    </TABLE></FONT>>]
        q_inset [label="inset?"]
        inset [label=<
    <FONT FACE="arial"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="2" CELLPADDING="5" ALIGN="left">
    <TR><TD BGCOLOR="gray90" ALIGN="left" WIDTH="200">Axes.inset_axes()</TD></TR>
    </TABLE></FONT>>]
        q_twin [label="twin?"]
        twin [label=<
    <FONT FACE="arial"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="2" CELLPADDING="5">
    <TR><TD BGCOLOR="gray90" ALIGN="left" WIDTH="200">plt.twinx()</TD><TD BGCOLOR="gray90" ALIGN="left" WIDTH="200">Axes.twinx()</TD></TR>
    <TR><TD BGCOLOR="gray90" ALIGN="left">plt.twiny()</TD><TD BGCOLOR="gray90" ALIGN="left">Axes.twiny()</TD></TR>
    </TABLE></FONT>>]
        axes [label=<
    <FONT FACE="arial"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="2" CELLPADDING="5">
    <TR><TD BGCOLOR="gray90" ALIGN="left" WIDTH="150">plt.axes()</TD><TD BGCOLOR="gray90" ALIGN="left" WIDTH="150">Figure.add_axes()</TD></TR>
    </TABLE></FONT>>]
    
        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
        }
    }
    
  6. QuLogic commented on Aug 30, 2021

    Member

    You can insert Graphviz diagrams into Sphinx; maybe you just want to copy what you have in directly somewhere?

  7. timhoffm commented on Aug 30, 2021

    MemberAuthor

    That's the plan. When trying that last year, it did not compile; see the original post. Should be tried again, but I don't have the time to work on this currently. Anybody is welcome to turn this in to a proper PR. But maybe it's better to wait until the new documentation structure is merged to see where in the docs this should go.

  8. added 4 commits that reference this issue on Jul 30, 2023
    c3ea8f6
    57b315e
    1ef72ed
    7e00b46
  9. github-actions commented on Aug 2, 2023

    This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

  10. QuLogic commented on Aug 2, 2023

    Member

    The PR has been opened; ergo this issue can stay open.

  11. added
    keepItems to be ignored by the “Stale” Github Action
    and removed
    status: inactiveMarked by the “Stale” Github Action
    on Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationkeepItems to be ignored 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


      Back | FazBrowse Home | New Git URL