I can confirm that using the --execute mechanism with the notebook does not cause the JavaScript portions that generate the interactive Bokeh plot to appear in the CLI-generated output.
I am not an expert in these things but if I had to guess I'd say that this is because `jupyter nbconvert --execute` is only going to do the server-side portion of executing the notebook. The rendered Bokeh plot is created by the client-side (i.e. "in browser") JavaScript and then (I think, but this is just a guess) that newly generated JavaScript + JSON + HTML is only "saved" on the server-side when the browser client UI selects "Save".
For you to get the same behavior with `jupyter nbconver --execute` it would be necessary to have a headless browser run the notebook. I suspect the Jupyter team are already aware of this issue, but a quick Google search doesn't turn anything up. If you submit an issue I think this is the place to do it:
Again, I can't be sure that my analysis is correct, but that is my best guess as to what is going on.
Good luck and let us know if you figure out the source of the problem and any solution/work-around.
Hi Ian,
Thanks a lot for the example, they are indeed visible on anaconda.org I wonder how they are hosted as HTML or in another format?
What I expect is to have actual interactive plot within *.ipynb file that is executed.
To test, download the attached "color_scatterplot.ipynb"
Run this: jupyter nbconvert --to notebook --execute color_scatterplot.ipynb --output color_scatterplot_output.ipynb
And check if you get the same output as attached one named "color_scatterplot_output.ipynb".
In this output, I have numbers in the brackets left to the cells which show they were executed but I cannot see the actual plot.
You can view these locally or online.
Best,
Gungor
On Monday, August 7, 2017 at 5:42:41 PM UTC+3, Ian Stokes-Rees wrote:
Hello Gungor,
Bryan is more expert on Bokeh, so you should go with his advice first, however for the notebook rendering on anaconda.org (which I have been involved with developing), I am fairly sure we are simply using `jupyter nbconvert` from the command line to create that content. And as you can see from anaconda.org examples the Bokeh plots display properly and are interactive, e.g.
Notebook :: Anaconda.org
(see Bokeh plot at the end of the notebook)
Are you able to share an example of the notebooks you have that do not convert/display properly?
Thanks,
Ian
On 8/7/17 11:33 AM, Güngör Budak wrote:
Hi Bryan,
I understand but it seems there is an embedding feature which puts plots inside an HTML and the plots will be rendered inside them. Isn't this an option for notebooks? I'm not going to host notebooks on GitHub but I need them pre-rendered. I saw there is also an option to include JS inside IPYNB file but still the plots are not there unless I open the notebook on the browser and run the cell manually.
Best,
Gungor
On Monday, August 7, 2017 at 5:22:52 PM UTC+3, Bryan Van de ven wrote:
Hi,
Bokeh plots are actually rendered by a companion JavaScrip library, BokehJS. However, GitHub strips all JavaScript from pages and notebooks that it renders. Bokeh will will never be able to display in notebooks rendered on GitHub as long as this is true (and we have no control whatsoever over this). To see Bokeh plots in rendered notebooks, you will have to
* view them locally, or
* on a site the preserves JS code intact, such as nbviewer.org or anaconda.org
Jupyter Notebook Viewer
Notebook :: Anaconda.org
Thanks,
Bryan
> On Aug 7, 2017, at 09:04, gng...@gmail.com wrote:
>
> Hi,
>
> I generate NB cells programmatically and then execute them using "jupyter nbconvert" but unlike matplotlib plots, Bokeh plots don't appear.
>
> Try downloading this example from main repo: https://raw.githubusercontent.com/bokeh/bokeh/master/examples/plotting/notebook/color_scatterplot.ipynb
>
> Run following:
>
> jupyter nbconvert --to notebook --execute color_scatterplot.ipynb --output color_scatterplot_run.ipynb
>
> In "color_scatterplot_run.ipynb", it seems the cells are executed but the plot doesn't show up. It does after manually running the corresponding cell.
>
> Thanks
> Gungor
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a74444ed-0b01-41b6-a2bb-a9fe7420ef57%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
To post to this group, send email to bo...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/2254cebb-e06f-41af-b5ca-e5ff7c99af0f%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
--
Ian Stokes-Rees, PhD
Computational Scientist
1.617.942.0218
ijst...@continuum.io
@ContinuumIO @ijstokes
--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0db5e5e4-b9cb-4c62-830e-28c83bb589ea%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.