-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Math in Plotly Figure Labels are not rendering using Quarto provided Mathjax #12060
Comments
Can you share you version of plotly ? Sharing I noticed some issues recently with new plotly v6 and Quarto. and I would like to see if this is related. Thanks. |
Are you sure in plain Python, this works? edit: it works in plain Python, see https://plotly.com/python/LaTeX/. Note that by default Quarto loads MathJax, see LaTeX Equations in HTML Also your YAML is not valid, see the execution options format:
html:
execute: true |
Definitely some conflict in JS library loaded. Here is what I get with plotly 5.24.1
This is required per documentation when Mathajx is not available in the context where graph is shown. See below
However, in Quarto mathjax can be made available but it will only be when Math syntax is found in the document. I need to check if this part of the template can be opt-in differently. We may need to detect plotly and math and add it otherwise. So currently, when you don't add math syntax in the document, mathjax won't be made available. When you add math, it will be available but... there is a conflict in how Mathjax is loaded, and how it applies on the math contains in the plotly graph. This is either a configuration thing, or a version conflict of MathJax. Thanks for the report. |
Same conflict with Plotly R by the way. Interactivity is not lost, but math in title axis are not shown with browser console error ---
title: plotly R with math
format: html
---
```{r}
library(plotly)
fig <- plot_ly() %>%
add_lines(x = c("a","b","c"), y = c(1,3,2))%>%
layout(title="sample figure", xaxis = list(title = r'($\sqrt{(n_\text{c}(t|{T_\text{early}}))}$)'), yaxis = list(title = r'($d, r \text{ (solar radius)}$)'), plot_bgcolor = "#c7daec")
fig
```
Some math
$$x$$ |
Possibly related It seems Mathjax specific to handling SVG needs to be loaded. As you did in shared example
We need to find a way to do both in a clever, or teach users how so setup using math in plotly when inside Quarto 🤔 |
I'm writing a report using Jupyter notebook in VSCode and I'm enable to use math expressions in figure labels while writing math in markdown too!
The output I'm trying to generate is an HTML file.
Here is my observations:
Here is a MRE reproducing the issue:
The text was updated successfully, but these errors were encountered: