Cannot display latex correctly in make_subplots
Open
Nobody has claimed this yet.
bug
P3
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
I am using make_subplots and insert latex math expression but it displays incorrectly.
Here is my sample code:
import plotly.graph_objs as go
from plotly.subplots import make_subplots
fig = make_subplots(rows=1, cols=2)
trace1 = go.Scatter(x=[1, 2, 3], y=[4, 5, 6])
trace2 = go.Scatter(x=[20, 30, 40], y=[50, 60, 70])
fig.add_trace(trace1, row=1, col=1)
fig.add_trace(trace2, row=1, col=2)
fig.update_layout(
xaxis=dict(title='$x^2$'),
xaxis2=dict(title='$\\sqrt{x}$')
)
fig.show()
Here is my output:
As you can see, it does not display correctly.
My setup:
OS: Ubuntu 20.04
Python: 3.10.9
Plotly: 5.16.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied Python example with Plotly 5.16.1 and compare how the two make_subplots axis titles render. Trace the title-rendering entry point used by make_subplots, then verify that both LaTeX expressions display correctly in the resulting figure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- latex, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100