Switching to inline plots in the Scientific View
Hi, I am currently evaluating PyCharm for its scientific mode. When I try to switch to the inline plot mode that is commonly supported on the Qtconsole and Spyder's integrated console, I am unable to do so and I get the following error:
```
%matplotlib inline
Matplotlib support failed
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 25, in do_import
succeeded = activate_func()
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydev_ipython/matplotlibtools.py", line 165, in activate_pyplot
pyplot.show._needmain = False
AttributeError: module 'matplotlib.pyplot' has no attribute 'show'
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydev_ipython/inputhook.py", line 529, in enable_gui
gui_hook = guis[gui]
KeyError: 'inline'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 129, in enable_gui
return real_enable_gui(gui, app)
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydev_ipython/inputhook.py", line 535, in enable_gui
raise ValueError(e)
ValueError: Invalid GUI request 'inline', valid ones are:dict_keys(['none', 'osx', 'tk', 'gtk', 'wx', 'qt', 'qt4', 'qt5', 'glut', 'pyglet', 'gtk3'])
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 2961, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-9e3324102725>", line 1, in <module>
get_ipython().run_line_magic('matplotlib', 'inline')
File "/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 2131, in run_line_magic
result = fn(*args,**kwargs)
File "<decorator-gen-107>", line 2, in matplotlib
File "/anaconda3/lib/python3.7/site-packages/IPython/core/magic.py", line 187, in <lambda>
call = lambda f, *a, **k: f(*a, **k)
File "/anaconda3/lib/python3.7/site-packages/IPython/core/magics/pylab.py", line 99, in matplotlib
gui, backend = self.shell.enable_matplotlib(args.gui)
File "/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3054, in enable_matplotlib
self.enable_gui(gui)
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 131, in enable_gui
raise UsageError("%s" % e)
IPython.core.error.UsageError: Invalid GUI request 'inline', valid ones are:dict_keys(['none', 'osx', 'tk', 'gtk', 'wx', 'qt', 'qt4', 'qt5', 'glut', 'pyglet', 'gtk3'])
```
How would I go about enabling inline output in the console?
Please sign in to leave a comment.
Hi,
Please make sure that you satisfy the requirements for using IPython Magic commands:
https://www.jetbrains.com/help/pycharm/ipython.html
https://www.jetbrains.com/help/pycharm/using-ipython-notebook-with-product.html
It seems you need to use Jupyter Notebook to work with this feature.
Please try it following the links above and let us know if you fave any issues.
I've reproduced your issue and it seems we currently do not support inline plots. Qtconsole is a third-party tools which has support for graphics inside the console. But PyCharm's console is text-based, it can't display graphics.
In theory we could display the pictures in the SciView window, but we do not support the inline mode.
Please feel free to submit a feature request about it to our issue tracker using the link https://youtrack.jetbrains.com/issues/PY and let us know if you need any help.