Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In plotly (python API): How to enable latex rendering in offline mode?

I am using plotly version 1.9.3, and using it to embed figures in jupyter notebook in offline mode using

init_notebook_mode()

When I enter TeX notation in labels, titles, etc., the Tex will not render (i.e. $\alpha$ will be displayed as source.

When I use the "save and edit in cloud" toolbar option, in the plotly website it renders correctly.

Can I configure it to render also in the offline mode?

I have both LaTex installation and a local installation of MathJax.

like image 621
Jonathan Kadmon Avatar asked Dec 28 '15 21:12

Jonathan Kadmon


2 Answers

At the moment, it unfortunately does not seem possible to configure plotly to properly render TeX notations in the offline mode. There is an open issue on their github repo with several users describing this problem.

like image 155
stephf0716 Avatar answered Nov 01 '22 18:11

stephf0716


For future reference, support was added for rendering LaTeX in offline mode in plotly.py version 3.4.0.

From https://github.com/plotly/plotly.py/blob/master/CHANGELOG.md#added:

Added LaTeX typesetting support for figures displayed in the Jupyter Notebook using plotly.offline.iplot and plotly.graph_objs.FigureWidget. Note: There are still outstanding issues with MathJax rendering in FireFox, but it is now working well in Chrome. (#1243)

like image 36
Jon Mease Avatar answered Nov 01 '22 17:11

Jon Mease