plotly / plotly/plotly.py

Latex plot titles are not rendered in VS Code

Open
#3,661 10 comments 4 reactions 0 assignees View on GitHub

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

Hi,

I try to rename my plot axis using latex titles, they are not rendered in my VS Code jupyter notebook, nor in an exported html using include_mathjax = 'cdn'.

fig = go.Figure(
    data=go.Scatter3d(x = [1,2,3],y=[2,3,1],z=[1,3,3]))
fig.update_layout(scene = dict(xaxis_title = r"$\lambda$"))
fig.show()

gives me:

image

The same expression in a markdown cell works:

$\lambda$

image

Using maplotlib works, as well.

I tried a workaround posted in #1740 using:

from IPython.display import display,HTML
display(HTML("""
<script type="text/javascript" async
  src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=config=TeX-AMS-MML_SVG">
</script>
"""))

without success.

Any help is appreciated!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example in a VS Code Jupyter notebook and in exported HTML with include_mathjax = 'cdn', then compare the plot-title behavior with the working markdown-cell example. The issue is resolved when LaTeX axis titles render in both environments without the unsuccessful MathJax workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, latex, python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.