-
Notifications
You must be signed in to change notification settings - Fork 2.1k
ENH: Double plotting issue #744
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
Conversation
Oh yeah, that seems much better! Didn't know about that. The double plotting issue was annoying. However, can you rebase your change on top of master instead of merging it? |
You could also do
|
I'm not sure I'm on board with this one. A limitation with the PyMC 2 plots is that they are essentially unmodifiable because the functions do not return the figure object when plotted. The nice thing about the plots in PyMC 3 is that with the figure object returned, you can add elements to the plot that are non-standard. It may not sound like a big deal, but when it comes time to use figures for publications, etc., one often requires some customization. All you have to do to prevent double-plotting with the current implementation is to either assign the output to a variable, or use a semi-colon at the end of the call. One alternative would be to allow for an |
hmm, good point. We could also have an argument that causes the value to be returned. Or we could always return it in a tuple or something so it doesn't get plotted the second time. |
How do the plotting libraries work here? with |
Yeah, returning |
See if the fix in double_plot_fix fits the bill. |
The reason why out plots double plot and pylab plots dont is that we're returning a matplotlib.figure.Figure and they're returning objects like [matplotlib.lines.Line2D at 0x104b492c]. |
@fonnesbeck the double plot fix looks good to me, though you're overwriting some other changes. |
@fonnesbeck your |
@jsalvatier that's bizarre. Not sure how that happened. Will fix. |
Closing this in favor of #745 |
This one-line change addresses the issue of two copies of the traceplot appearing when using
pm.traceplot(trace)
in theipython notebook
, as described in #243. I know there is a simple workaround described there, but I would prefer this to "just work". I couldn't find any code where the returnedfig
was used, and if you have some, you can useplt.gcf()
to get a reference to the current figure after callingpm.traceplot
.