Using plotly - heatmap with Jupyterlab very slow

#1

Hi all,

I recently start using plotly with Juptyter lab. One of the issue I am facing is jupyterlab slows down when creating 2 heatmap each size around 30Mb. Especially if in jupyterlab I decide to make “Create new output view” I can not do anything once output view create, sometimes browser even crash. I try both with chrome and firefox, I have latest jupyterlab and plotly.

#2

Hi @mtkilic,

You could try using heatmapgl rather than heatmap. See https://plot.ly/python/heatmap-webgl/.

Or, you could try using the iframe renderer as described at Plotly - notebook / Very slow render with many graphs.

-Jon

#3

Hi @jmmease thank you for the reply.

Using FigureWidget with heatmap in better than heatmapgl. Tooltip for heatmapgl is very slow compare to heatmap

I did try to use iframe (offline mode) I can see .html files getting created but it wont display on Jupyterlab I get following JS error Uncaught ReferenceError: Plotly is not defined. I try to pass following at the beginning `%%HTML

` but this didn't solve the issue.

Here is the 3 plot shapes I am trying to display on Jupyterlab at the same time
(3763, 7649)
(7649, 1001)
(3763, 1001)

Thank you in advance for trying to help me out.

#4

Hi @mtkilic,

Just to be explicit, here’s an example of the iframe renderer approach.

import plotly.io as pio
import plotly.graph_objs as go
pio.renderers.default = 'iframe'
fig = go.Figure(data=[go.Heatmap(z=[[1, 2], [2, 4]])])
pio.show(fig)

Does this example display for you?
-Jon

#5

Hi @jmmease

Not this doesn’t display anything, however it does create a .html file under iframe_figures. I can not open this html file in jupyterlab but I can open from google chrome than I do see the heatmap.

I also see this following error too:
GET http://localhost:8888/files/iframe_figures/plotly.min.js
net::ERR_ABORTED 403 (Forbidden)

Edit: I just try iframe on Firefox and everything works fine. Its actually much faster too. Looks like chrome is blocking for some reason.