Skip to content

Python plots agglomerating, history not working? #4588

Answered by isabelizimm
marcdotson asked this question in Q&A
Discussion options

You must be logged in to vote

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 figure fig, 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:

  1. add plt.clf() between each plt.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…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@marcdotson
Comment options

Answer selected by marcdotson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants