Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returning matplotlib.figure/axes? #3

Closed
nipunbatra opened this issue Mar 30, 2016 · 4 comments
Closed

Returning matplotlib.figure/axes? #3

nipunbatra opened this issue Mar 30, 2016 · 4 comments

Comments

@nipunbatra
Copy link

Hi,
For users who want to fiddle around with the produced plot, it would be helpful to return the matplotllib.figure/axis. My use case- I want to give a ylabel to the rows to use in a publication.

@ResidentMario
Copy link
Owner

Ah, so instead of ending with fig.show(), something like ending with plt.show(); return fig? Good idea; I'll take a look at seaborn to see how it handles that.

@nipunbatra
Copy link
Author

Yes, and it'll also allow a user to save the figure to a png or pdf. Also, returning the figure will allow these plots to be interfaced with mpld3 and Plotly.

@ResidentMario
Copy link
Owner

Ok, so the default seaborn behavior is to both plot the figure and return a matplotlib object of some sort. However, I find this in-ideal, as the returned plot element's return statement pollutes the view:

example

Note the <matplotlib.axes._subplots.AxesSubplot at 0x1147a0f0>.

To overcome this in my current build I've added a inline=True argument which hooks into the following method ending:

if inline:
    plt.show()
else:
    return fig.axes

If inline is left alone missingno will draw the plot and no more.

If inline is set to False it will return the axes:

example_2

@nipunbatra Do you think this is a good solution?

@ResidentMario
Copy link
Owner

Addressed prior to 3a5420e.

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

No branches or pull requests

2 participants