Skip to content

scatter_plot produces double plots #3474

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

Closed
ghost opened this issue Apr 28, 2013 · 18 comments
Closed

scatter_plot produces double plots #3474

ghost opened this issue Apr 28, 2013 · 18 comments
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Apr 28, 2013

following #3473:

import pandas as pd
import numpy as np
from pandas.tools.plotting import scatter_plot 

df = pd.DataFrame( np.random.randn(100,4))
scatter_plot(df,x=1,y=2)

**Plot**

**Same Plot Again**
@cpcloud
Copy link
Member

cpcloud commented Apr 28, 2013

What backend are you using? I can't repro this.

@ghost
Copy link
Author

ghost commented Apr 28, 2013

just plain ol'

ipython qtconsole --pytlab=inline

@cpcloud
Copy link
Member

cpcloud commented Apr 28, 2013

I see it now. Returning fig is the problem. Returning just the axes would probably be the most consistent with the pandas API.

@cpcloud
Copy link
Member

cpcloud commented Apr 28, 2013

I need some git-fu practice, is it possible for me to fix someone else's PR?

@ghost
Copy link
Author

ghost commented Apr 28, 2013

hang on, there's some sort of blood oath with statsmodels in the mists of time on how we do plots...
here it is : #1501 (comment)

no on the latter, unless you're a repo collab on his fork.

@cpcloud
Copy link
Member

cpcloud commented Apr 28, 2013

Ah, ok. Thanks. Well, qtconsole seems to be violating the blood-oath :)

@jseabold
Copy link
Contributor

jseabold commented May 3, 2013

This "blood oath" was on the advice from the matplotlib and IPython creators on the best and most general way to write library plotting code. Please bring up specific issues in a public forum, so we can continue to coordinate.

@ghost
Copy link
Author

ghost commented May 3, 2013

That wasn't a criticism, it's just hidden away on an old issue and I wanted to make it known.
Is there anywhere documenting the rationale? would appreciate having somewhere to to point
to when this comes up.

@jseabold
Copy link
Contributor

jseabold commented May 3, 2013

Didn't mean to sound defensive. Was trying to dispel mysticism. Advice we've been going on.

https://groups.google.com/d/topic/pystatsmodels/biNlCvJPNNY/discussion

@ghost
Copy link
Author

ghost commented May 3, 2013

added to CONTRIBUTING.md

@jseabold
Copy link
Contributor

jseabold commented May 3, 2013

FYI, you just need to catch the fig to keep it from displaying (or turning off inline plotting should also work)

fig = plot_func()

@cpcloud
Copy link
Member

cpcloud commented May 10, 2013

@jseabold I think only the latter will work, since returning the Figure object is what is causing this bug.

@jseabold
Copy link
Contributor

Both work. Try 'em out. FWIW, I don't consider this a bug.

@cpcloud
Copy link
Member

cpcloud commented May 10, 2013

@jseabold I agree, I actually quoted bug but I changed it because I didn't want to sound like a smart-ass.

@cpcloud
Copy link
Member

cpcloud commented Jun 25, 2013

@jseabold fig = plot_func() doesn't prevent display on ipython qtconsole --pylab=inline so i think that particular issue is a bug, one which i'm not sure how to get around

@jseabold
Copy link
Contributor

It displays because pylab=inline is interactive mode. That's why the fig pops up. If you want to completely suppress a figure, you can turn off interactive mode.

import matplotlib.pyplot as plt
plt.ioff()

fig = plot_func()

@cpcloud
Copy link
Member

cpcloud commented Aug 23, 2013

can this be closed? i don't think this is a bug. bootstrap_plot will also show up twice. any function that returns a Figure object will show up twice.

@jtratner
Copy link
Contributor

agreed - not a bug.

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

No branches or pull requests

3 participants