[SOLVED] How to plot in jupyter qtconsole


#1

OS X
Jupyter QtConsole 4.4.3
Python 3.7.1 (default, Dec 14 2018, 13:28:58)
IPython 7.2.0 – An enhanced Interactive Python. Type ‘?’ for help.

Can plot matplotlib graphs

But when trying plotly, there is no output in the console

If I use go.Figure, I get a Warning message as below:

The offline plotting in the browser works. But I would really like to use the Jupyter console if possible. It’s supposed to work is it not?


#2

Hi @awsm,

There’s nothing built-in for this yet (I hope to change this before too long), but here’s a way to do it today. Install orca (https://plot.ly/python/static-image-export/), and then define this utility function

from IPython.display import display, Image
import plotly.io as pio

def show(fig):
    display(Image(pio.to_image(fig, format='png')))

Then…

Note that the very first time you show a figure it will take a few seconds for the orca server to start up. But after that, image display should be about as fast as matplotlib. https://medium.com/@plotlygraphs/plotly-py-end-of-summer-updates-5422c98b9058

Hope that helps, and let us know how it goes!

-Jon


#3

@jmmease
Sweeet!! Thank you, it works!

By the way, how did you get rid of the scroll bars on the qtconsole window?


#4

Awesome!

I think my scrollbars are hidden because I’m on MacOS, which hides the scroll bars unless you are scrolling. The same thing happens in most other MacOS applications.

-Jon


#5

I see. Thank you. It’s too bad there isn’t a way to disable scrollbars like a regular Terminal.