You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Figure does not display LaTeX expressions in JupyterLab and Jupyter Notebook #1740
And this is strange as earlier today it did work fine.
I have encountered other anomalies in JupyterLab, such as after restarting the session, one image elongates and stays like that.
Does not happen every time though.
Details
Plotly version: 4.0.0
Ubuntu 18.04.2
Here it is:
Sometimes it elongates and stays like that:
UPDATE 1:
I've just updated to 4.1.0 and now the LaTeX titles are displayed. But, the mentioned anomaly is still there.
UPDATE 2:
I have opened the notebook today again and the title disappears.
If it is of any help. here is what is displayed in the terminal:
The only outstanding issue is that unlike the classic notebook, JupyterLab doesn't seem to load the global MathJax instance until it is needed by the markdown renderer.
I would like to solve this; any kind of initial help regarding at which code to look would be helpful. I briefly inspected the console and found MathJax in the window object. It does not seem related to #1243 or jupyter-widgets/ipywidgets#2253 since rendering markdown / loading ipywidgets and rendering latex before trying to render latex title in plotly does not solve the issue.
I can replicate the JupyterLab problem on my end also. The issue is likely to be within the interaction between the way jupyterlab_plotly extension renders Plotly.js figures within JupyterLab, and these problems tend to be pretty hard to debug but if you want to give it a shot, the source for the extension is here: https://github.com/plotly/plotly.py/tree/master/packages/javascript/jupyterlab-plotly
I'll add that the LaTeX information is not lost: rendering the same figure in a Dash app or in another context than JLab works (e.g. exporting a notebook to HTML), and in a pinch you can render it in JLab if you have Kaleido installed with fig.show("svg") (without interactivity, unfortunately)
Having it render without a kernel/rerunning cells is WIP, this error shows up on the browser console and on the output cell there's a text only FigureWidget=(...
Resize must be passed a displayed plot div element.
If instead of a FigureWidget I use a Figure, the figure renders on opening with jupyterlab.
If I reload the page, MathJax dissapears from the global namespace and latex is not rendered.
At this point, the workaround above + using only go.Figure and not FigureWidgets gets almost to right place.
I need to run in a different notebook the javascript that loads MathJax ( or via a user script in my browser), and then latex will load correctly. I did it via GreaseMonkey:
Additionally, regarding size of the notebook, FigureWidget packs 3.6MB for ploty.js, while Figure refers to the jupyterlab extension. If I specify pio.renderers.default = 'jupyterlab', it's small again (83kB).
If I export the notebook to html, FigureWidget renders properly, Figure does not: only the static preview is shown, while FigureWidget updates to the dynamic javascript.
This with the 'jupyterlab' renderer. 'iframe_connected' does not survive page reloads.
Dealing with rather simple Latex I found a dependency on browser plotly/plotly.js#5374 (comment) ."Why do you use Edge? Plotly edge-case".
This was on: Firefox 93.0, Jupyterlab 3.2.0, plotly 5.3.1, python 3.9.7.
I found a solution that worked for me in the help documentation, changing the default renderer. I had the issue on multiple browsers. (https://plotly.com/python/renderers/)
The jupyterlab-plotly extension must be installed in the current environment. For conda, this is conda install -c conda-forge jupyterlab-plotly-extension.
Check the available renderers and ensure jupyterlab is available.
import plotly.io as pio
pio.renderers
changed the title [-]Figure does not display LaTeX title[/-][+]Figure does not display LaTeX expressions in JupyterLab and Jupyter Notebook[/+]on Jul 16, 2026
Activity
cnydw commentedon Oct 23, 2019
Related to outstanding issues in #1243 (comment)
and jupyter-widgets/ipywidgets#2253
LunarLanding commentedon Mar 27, 2021
Same here:
MVE:
Render markdown with latex (works), then:
Shows (notice no title):

Plotly: 4.14.3
JupyteLab: 3.0.12
LunarLanding commentedon Mar 31, 2021
I would like to solve this; any kind of initial help regarding at which code to look would be helpful. I briefly inspected the console and found MathJax in the
windowobject. It does not seem related to #1243 or jupyter-widgets/ipywidgets#2253 since rendering markdown / loading ipywidgets and rendering latex before trying to render latex title in plotly does not solve the issue.empet commentedon Mar 31, 2021
@LunarLanding
titleis a dict:or you can avoid using dicts, as follows:
LunarLanding commentedon Mar 31, 2021
Latex with a dict does not work:
Without latex, using title directly works, without latex (not the issue being discussed):
empet commentedon Mar 31, 2021
I read only your post and did not notice that you are working with jupyterlab.

I checked it in Jupyter Notebook:
LunarLanding commentedon Mar 31, 2021
Thanks. This issue is specific to JupyterLab then; which is also what the original poster reported.
nicolaskruchten commentedon Mar 31, 2021
I can replicate the JupyterLab problem on my end also. The issue is likely to be within the interaction between the way
jupyterlab_plotlyextension renders Plotly.js figures within JupyterLab, and these problems tend to be pretty hard to debug but if you want to give it a shot, the source for the extension is here: https://github.com/plotly/plotly.py/tree/master/packages/javascript/jupyterlab-plotlynicolaskruchten commentedon Mar 31, 2021
I'll add that the LaTeX information is not lost: rendering the same figure in a Dash app or in another context than JLab works (e.g. exporting a notebook to HTML), and in a pinch you can render it in JLab if you have Kaleido installed with
fig.show("svg")(without interactivity, unfortunately)LunarLanding commentedon Oct 18, 2021
I think the issue is that Mathjax is not by default present in the global namespace anymore, the same as in jupyter-widgets/ipywidgets#2253 which one extension worked around like this vidartf/phoila@2b7ddf0 .
If I run this before running the plotly cell, latex is rendered correctly.
Having it render without a kernel/rerunning cells is WIP, this error shows up on the browser console and on the output cell there's a text only
FigureWidget=(...If instead of a FigureWidget I use a Figure, the figure renders on opening with jupyterlab.
If I reload the page, MathJax dissapears from the global namespace and latex is not rendered.
At this point, the workaround above + using only go.Figure and not FigureWidgets gets almost to right place.
I need to run in a different notebook the javascript that loads MathJax ( or via a user script in my browser), and then latex will load correctly. I did it via GreaseMonkey:
Additionally, regarding size of the notebook, FigureWidget packs 3.6MB for ploty.js, while Figure refers to the jupyterlab extension. If I specify
pio.renderers.default = 'jupyterlab', it's small again (83kB).If I export the notebook to html, FigureWidget renders properly, Figure does not: only the static preview is shown, while FigureWidget updates to the dynamic javascript.
This with the 'jupyterlab' renderer. 'iframe_connected' does not survive page reloads.
Dealing with rather simple Latex I found a dependency on browser plotly/plotly.js#5374 (comment) ."Why do you use Edge? Plotly edge-case".
This was on: Firefox 93.0, Jupyterlab 3.2.0, plotly 5.3.1, python 3.9.7.
QuantumAudio commentedon Jun 18, 2022
I found a solution that worked for me in the help documentation, changing the default renderer. I had the issue on multiple browsers. (https://plotly.com/python/renderers/)
The jupyterlab-plotly extension must be installed in the current environment. For conda, this is conda install -c conda-forge jupyterlab-plotly-extension.
Check the available renderers and ensure jupyterlab is available.
import plotly.io as pio
pio.renderers
Renderers configuration
pio.renderers.default = 'jupyterlab'
emilykl commentedon Jul 16, 2026
Confirmed in Jupyter Notebook 7 with Plotly 6.9.0 (plotly.js 3.7.0).
Though I am seeing the raw input text rather than an empty space.

[-]Figure does not display LaTeX title[/-][+]Figure does not display LaTeX expressions in JupyterLab and Jupyter Notebook[/+]