plotly / Dash.jl

Dash for Julia - A Julia interface to the Dash ecosystem for creating analytic web applications in Julia. No JavaScript required.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LaTeX rendering

MichaelHatherly opened this issue · comments

Thanks for the package! Would be really great if rendering of LaTeX equations was possible out of the box, perhaps by passing a LaTeXString object as the children of a node. If this isn't suitable for inclusion in the core packages could I get some hints regarding building/using custom components with Dash.jl? I'm happy to contribute this back to the package if it's doable.

Plotly figures support Latex generation, so one way to do this would be to generate a blank Plotly figure with a LaTeX annotation. Here's an example:

https://plotly.com/~jackp/18758/

image

Removing everything but the annotation gives you this:

https://plotly.com/~jackp/18760/

image

Doesn't appear that Latex or annotations are documented yet on http://juliaplots.org/PlotlyJS.jl/ yet (@sglyon), so you'll have to infer from the analogous Python docs (the syntax is similar).

An alternative approach would be to publish your own Dash component using something like react-latex as the starting point. Here's the process for turning React components into Dash components: https://dash.plotly.com/plugins

An alternative approach would be to publish your own Dash component using something like react-latex as the starting point. Here's the process for turning React components into Dash components: dash.plotly.com/plugins

We went with wrapping a mathjax component in the end, which is working out fine. I'll close this now since it's not really necessary to have the feature in any official dash package.