jstac / quantecon_nyu_2016

Quantitative Economics
BSD 3-Clause "New" or "Revised" License
134 stars 77 forks source link

Embedding PlotlyJS in Jupyter Notebooks #20

Closed arnavs closed 6 years ago

arnavs commented 8 years ago

What's the best way to do this? It looks like there's an offline mode for Python that we can use with Jupyter, but I didn't find anything similar for Julia.

Update: Here's what it looks like when you view the raw plot() output in GitHub. The plot renders naturally as output in the Jupyter notebook.

screen shot 2016-03-05 at 3 25 49 pm

sglyon commented 8 years ago

Embedding should be automatic. You might try to do using PlotlyJS and the plot command in a different cell. It might be that we aren't giving enough time for the javascript to load before we try to plot with it.

I don't know for sure if that will work, but that's my hunch. I've never had a problem in the notebook.

Let me know how it goes

arnavs commented 8 years ago

Sounds good.

In that case, I'm thinking it's a GitHub thing (sometimes it displays features of Jupyter notebooks, like LaTeX, weirdly). The plots actually looked fine on my machine even with the setup above, they just took a second to spin up.

Thanks for looking into it.

sglyon commented 8 years ago

Oh yeah github definitely won't show it.

Github doesn't render any external javascript, and that's how we show our plots. If you want to see it in a notebook online you should use nbviewer (just give them the link to the notebook on github)

arnavs commented 8 years ago

Ah gotcha. Ok, sweet.