Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plot into Pycharm's IPython console

I'm using spyder and pycharm for python coding. When I plot something with matplotlib in spyder it shows the result inline in IPython. With Pycharm IPython plots in a new extra window. I'm working on Windows7 and with Anaconda Python2.7.

Is it possible to plot in Pycharm inside in the IPython shell?

like image 245
gustavgans Avatar asked Jun 13 '15 07:06

gustavgans


People also ask

How do I use IPython console?

The IPython Console allows you to execute commands and interact with data inside IPython interpreters. To launch a new IPython instance, go to New console (default settings) under the Consoles menu, or use the keyboard shortcut Ctrl - T ( Cmd - T on macOS) when the console is focused.

How do you display plots in Jupyter notebook?

The inline option with the %matplotlib magic function renders the plot out cell even if show() function of plot object is not called. The show() function causes the figure to be displayed below in[] cell without out[] with number. Now, add plt. show() at the end and run the cell again to see the difference.

Can PyCharm show plots?

Interactive plots in the SciView window are not supported by PyCharm at the moment. If you want to use the mouse cursor to see the values at specific graph points, you can render plots in the native matplotlib GUI.


2 Answers

Not inside the shell; however, you can use an iPython notebook within PyCharm (2016+) for that purpose. PyCharm supports iPython plots when defined within a .ipynb (iPython/Jupyter file format) script.

Here is an example: Open, or create (as shown) a .ipynb script:

enter image description here

An here is what you get if you code inside a freshly made .ipynb file within PyCharm 2016 or later. Notice the %matplotlib inline, which comes after matplotlib.pyplot import.

enter image description here

like image 200
Pouria Avatar answered Oct 08 '22 19:10

Pouria


PyCharm 2019.1+

In this version of PyCharm several great features to integrate Jupyter Notebooks and PyCharm were added.

First, create a new Jupyter Notebook or open up an existing one.

Second, you can Insert a new cell or you can work on existing cells.

enter image description here

Third, you can Run or Debug a Cell:

enter image description here

Fourth, if you run the cell, the result will be reflected in the right side of the screen.

enter image description here

like image 24
lmiguelvargasf Avatar answered Oct 08 '22 20:10

lmiguelvargasf