27

I am using PyCharm as the IDE for python, and when you make a plot (with the same code like pyplot.plot(...), pyplot.show()) pycharm displays it within its IDE. However, this looks like a static image. When you zoom in, the plot starts to blur.

In other IDE, pyplot creates an interactive plot. When you zoom in, it basically re-plots the curve. And you can also drag the plot. Is there anyway in PyCharm I can have the interactive plot from pyplot?

enter image description here enter image description here

7
  • No. When you save the plot it becomes an image. Commented Apr 15, 2018 at 16:25
  • 25
    Disable Settings | Tools | Python Scientific | Show plots in tool window. It should do the trick. Commented Apr 17, 2018 at 9:40
  • 5
    As Pavel described here (intellij-support.jetbrains.com/hc/en-us/community/posts/…) you may also need to change your backend e. g. using matplotlib.use('Qt5Agg') or matplotlib.use('TkAgg') Commented Oct 11, 2019 at 6:39
  • @PavelKarateev I don't see "Python Scientific" under "Tools". Searching settings for plots or scientific doesn't show anything either. Commented Feb 27, 2023 at 22:41
  • 2
    @endolith The new path is Settings | Tools | Python Plots | Show plots in tool window Commented Jan 19, 2024 at 12:21

1 Answer 1

20

Just need to change your plotting backend.

If you're on macOS:

import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.use('macosx')

plt.plot(range(10))

should produce a new window that looks like this: enter image description here

Or if you prefer a different backend or are on Windows (as @MichaelA said)

import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.use('Qt5Agg')  # or can use 'TkAgg', whatever you have/prefer

plt.plot(range(10))
Sign up to request clarification or add additional context in comments.

1 Comment

For anyone curious, I'd just like to mention that both this answer and the comment from Pavel Karateev on the question for disabling Show plots in tool window result in an interactive plot for me on Mac OS X 10.14.6 with PyCharm 2020.1.1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.