Python plots agglomerating, history not working? #4588
-
I've searched for issues and discussions related to this problem and haven't found anything. Before opening an issue, I wanted to double check that this isn't hidden away in a more technical issue or discussion that I'm not tracking. I'm working in a Python-only Positron project and have found that the Python plots are agglomerating: Each plot is being added onto the previous plot(s) instead of showing up as a separate plot in the history. This problem:
I've duplicated the problem following along with Christoph Scheuch's excellent matplotlib and seaborn blog posts. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Strange update: I just started producing seaborn.objects plots and the issue is not present. The plots aren't agglomerating and the plot history is working. |
Beta Was this translation helpful? Give feedback.
-
Thank you for raising this confusing interaction! 🌻 This is related to the different matplotlib APIs. The code in the blog post referenced uses the implicit interface, where you operate directly on There are a few options to tell
|
Beta Was this translation helpful? Give feedback.
Thank you for raising this confusing interaction! 🌻 This is related to the different matplotlib APIs. The code in the blog post referenced uses the implicit interface, where you operate directly on
plt.XXXXX
, versus the explicit interface where you generate an axis and figurefig, ax = plt.subplots()
. While using the implicit interface, Positron allows you to iterate on a single plot, which is the behavior you're seeing.There are a few options to tell
matplotlib
that you are operating on a different figure:plt.clf()
between eachplt.show()
call. This will not give you the film strip in Positron, since you’re essentially working on the same plot, but it will clear the plot so you do…