8000 LaTeX not rendering in Plotly figures · Issue #8131 · microsoft/vscode-jupyter · GitHub
[go: up one dir, main page]

Skip to content
LaTeX not rendering in Plotly figures #8131
@stephteo

Description

@stephteo

Environment data

  • VS Code version: 1.61.2
  • Jupyter Extension version (available under the Extensions sidebar): v2021.9.1101343141
  • Python Extension version (available under the Extensions sidebar): v2021.10.1365161279
  • OS (Windows | Mac | Linux distro) and version: Mac Big Sur Version 11.6
  • Python and/or Anaconda version: Python 3.9.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): XXX
  • Jupyter server running: Tried both Local and Remote
  • Plotly version: 4.14.3

Expected behaviour

Successfully have LaTeX render in Plotly figures when running on either Jupyter Notebook or JupyterLab from a Chrome browser (Version 95.0.4638.54). Tested this with the examples directly from Plotly: https://plotly.com/python/LaTeX/

import plotly.express as px

fig = px.line(x=[1, 2, 3, 4], y=[1, 4, 9, 16], title=r'$\alpha_{1c} = 352 \pm 11 \text{ km s}^{-1}$')
fig.update_layout(
    xaxis_title=r'$\sqrt{(n_\text{c}(t|{T_\text{early}}))}$',
    yaxis_title=r'$d, r \text{ (solar radius)}$'
)
fig.show()

Screen Shot 2021-11-01 at 3 59 29 PM

import plotly.graph_objs as go

fig = go.Figure()
fig.add_trace(go.Scatter(
    x=[1, 2, 3, 4],
    y=[1, 4, 9, 16],
    name=r'$\alpha_{1c} = 352 \pm 11 \text{ km s}^{-1}$'
))
fig.add_trace(go.Scatter(
    x=[1, 2, 3, 4],
    y=[0.5, 2, 4.5, 8],
    name=r'$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$'
))
fig.update_layout(
    xaxis_title=r'$\sqrt{(n_\text{c}(t|{T_\text{early}}))}$',
    yaxis_title=r'$d, r \text{ (solar radius)}$'
)
fig.show()

Screen Shot 2021-11-01 at 3 59 36 PM

Note: Using Chrome because there is a bug in Firefox that prevents proper rendering of Plotly figures with Mathjax (plotly/plotly.js#5993)

It looks like this may be related to this issue: #6802 since you can wrap the above figure in Plotly FigureWidget:

f = go.FigureWidget(fig)
f.show()

Actual behaviour

No LaTeX rendering when using the same Jupyter notebook in VS Code.

Screen Shot 2021-11-01 at 3 58 34 PM

Screen Shot 2021-11-01 at 3 58 28 PM

Steps to reproduce:

Simply run any of the above code in VS Code with the same environment as listed above.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0