I am having a strange behavior with bokeh library.
So apparently, I am trying to create some beautiful plots with bokeh. When I try to load the bokeh in JupyterLab, I get constant, "Loading bokehJS..." message but if I try to plot with jupyter (from bokeh.io import output_notebook, show output_notebook()), I could plot it. It looks like lab has some issues? or am I not using lab properly?
comparative screenshot attached. Dark (JupyterLab), Light(Jupyter Notebook)
You likely need to install the jupyterlab_bokeh extension:
https://docs.bokeh.org/en/latest/docs/user_guide/notebook.html#jupyterlab
Related
I am using PyCharm 2019.2 Professional and I am trying to figure out how to display a .png file within a markdown cell. My file is located in a subfolder called screenshots.
I tried the following line of code; however, PyCharm will not display the image. I just see an empty rectangle.
![test.png](screenshots/test.png]
After 4 short years, JetBrains finally fixed this issue in PyCharm 2021.3 EAP. The patch will not be ported to 2021.2 or earlier versions. See this thread.
If you're using an older PyCharm version and don't feel like updating right now, here is a dirty hack to print images on a grid in your notebook in PyCharm using matplotlib:
import matplotlib.pyplot as plt
f, ax = plt.subplots(1, 3)
ax[0].imshow(plt.imread('iguanas1.png'))
ax[1].imshow(plt.imread('iguanas2.png'))
ax[2].imshow(plt.imread('iguanas3.png'))
My jupyter notebooks that have plotly plots do not retain the plots between sessions.
This is running on a Singularity container based on the official jupyter/datascience-notebook docker image with plotly pip installed on top.
I am using the new renderer framework with the notebook renderer.
My notebooks are trusted.
My plots show up during the session without issues.
They persist across refreshes and reloads of the same notebook, even if I restart the kernel.
They disappear either when I restart the jupyter server or sometimes when I reboot the client machine and come back with a new browser session.
The output cells persist with the correct dimensions, but they are blank.
I can see that a whole bunch of js is embedded in the notebook but it does not render in the browser.
At this point, even if I nbconvert to html, they still do not show up.
Tried with Chromium and Firefox.
import plotly.graph_objects as go
import plotly.io as pio
import plotly.express as px
pio.renderers.default='notebook'
then later I plot a bunch of things like:
go.Figure(go.Scattergl(x = var1, y= var2, mode='markers', marker_size=1))
and
go.Figure(go.Histogram2dContour(x = var1, y= var2))
My understanding is that I am set up to retain these figures in offline (non-running) notebooks; the js generated for the plots and the entirety of plotly.js library appears to be embedded in each notebook adding up to 10s of MBs, but they are not rendered.
Due to this issue I end up having to re-run (sometimes expensive) notebooks when all I need is to take a look at a previous plot.
As a recent matplotlib/seaborn convert I absolutely love the interactivity but this is quickly becoming a showstopper at this point.
I feel like I'm missing something.
Any advice is appreciated.
For me, the following solution worked :
in the environment you're using : install orca :
conda install -c plotly plotly-orca
at the beginning of your notebook : override default renderer as 'notebook' :
import plotly.io as pio
pio.renderers.default='notebook'
plotly graphs were persistent between sessions (ie : after restart of kernels) with these modifications.
I can't get any HoloViews graphics to display in any Google Colabs notebook.
For example even the simple Bokeh example right out fo the HoloViews introduction
points = hv.Points(np.random.randn(500,2))
points.hist(num_bins=51, dimension=['x','y'])
fails to show anything, without any error being reported, while the same code (and all example code from HoloViews) works fine in local Jupyter notebooks.
If I download the Colabs notebook locally and open it, I see the following where I say nothing for output in Colabs:
No (safe) renderer could be found for output. It has the following MIME types: application/javascript, application/vnd.bokehjs_load.v0+json
How do I get Bokeh HoloViews to display in Google Colabs notebooks?
See https://github.com/pyviz/holoviews/issues/3551 . Colaboratory has some serious limitations on how it handles notebooks, and for now you have to do this once:
import os, holoviews as hv
os.environ['HV_DOC_HTML'] = 'true'
Then for every single cell with a plot in it you have to re-load the JS:
hv.extension('bokeh')
hv.Curve([1, 2, 3])
It would be great if Google could fix that, as it's unworkable in my opinion.
When I run my code all my graphs (both ggplot2 and plot) are displayed in an external "Quartz 2 [*]" graphical viewer.
I would like them to be displayed in the R studio GUI plot area to I can better save and view my files, along with the previous versions.
Is there anyway to stop this?
I recently updated my version of R, along with the X11 and xQuartz on my mac (also up to date), and I am guessing these updates are behind it.
I have seen many forums explaining how to get rstudio to export to an external viewer (e.g. "quartz()"), but not the other way.
I have looked, but these threads have not helped:
ggplot plots in scripts do not display in Rstudio
plot panel does not produce plots Rstudio
dev.off() even when hidden hide <- dev.off() is not working either.
Any help would be great,
Thanks.
If you upgrade R without upgrading RStudio, the graphics engine may not be compatible. To fix the "Quartz 2" popout, upgrade RStudio to a newer version that supports the graphics engine in the version of R you have installed.
I had the same problem, and noticed the following output to the console:
Warning message:
R graphics engine version 15 is not supported by this version of RStudio. The Plots tab will be disabled until a newer version of RStudio is installed.
Looks like I forgot to reinstall Rstudio as well.. That sorted my problem.
Is there a way to display an IFrame in an IJulia Jupyter notebook?
I am trying to use Plotly.jl with Jupyter. When plot is called it returns a URL linking to the generated graph.
Using an IFrame should allow this to work out.
Plotly.plot(["z"=>rand(6,6)],["style"=>["type"=>"heatmap"]])
https://plot.ly/~astrieanna/0 # Returned URL
This is not an answer the the posted question, but it does solve the issue with plotly.
Plotly.jl is about to undergo massive changes. One of these will be relying on the PlotlyJS.jl package for all plot generation and display.
If you want to use plotly from julia in a jupyter notebook you should use PlotlyJS.jl: https://github.com/spencerlyon2/PlotlyJS.jl
Docs here: http://spencerlyon.com/PlotlyJS.jl/
IJuliaPortrayals has an IFrame constructor.
IFrame(600, 200, "http://julialang.org")
At In [15]:
Bring back 2003-era pages with IFrame!