Skip to content
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

Latex is not Rendered in Plotly #2941

Open
mauricekraus opened this issue Jul 24, 2023 · 2 comments
Open

Latex is not Rendered in Plotly #2941

mauricekraus opened this issue Jul 24, 2023 · 2 comments
Labels
help wanted Extra attention is needed type / bug Issue type: something isn't working

Comments

@mauricekraus
Copy link
Contributor

🐛 Bug

image
Latex is not rendered in the aim UI.

To reproduce

Just use any matplotlib based figure with latex in the legened.

Expected behavior

Latex is correctly rendered

Environment

  • Aim Version (e.g., 3.17.5)
  • Python version 3.10.6
  • pip version 23.2.1
  • OS Arch Linux
  • Example Running in a 22.10 Ubuntu docker image.

Additional context

Might be related to microsoft/vscode-jupyter#8131

@mauricekraus mauricekraus added help wanted Extra attention is needed type / bug Issue type: something isn't working labels Jul 24, 2023
@gorarakelyan
Copy link
Contributor

@mauricekraus this might be a plotly matplotlib conversion limitation, when trying to display it interactively on the browser. A workaround could be tracking matplotlib figures as Aim images.

@mauricekraus
Copy link
Contributor Author

@gorarakelyan Thank you for your answer. The problem is that the default Ploty "html" does not include mathjax. When we make the conversion our self it works. What do you think? (WandB suffers from the same problem)

# Import modules
import numpy as np
import matplotlib.pyplot as plt
from plotly.tools import mpl_to_plotly

# Create some data arrays
x = np.linspace(-2.0 * np.pi, 2.0 * np.pi, 51)
y = np.sin(x)

# Make a plot
mpl_fig = plt.figure()
plt.plot(x, y, 'ko--')
plt.title('$\\alpha$ sin(x) from -2*pi to 2*pi')
plt.xlabel('x')
plt.ylabel('sin(x)')
# plt.show()

# Export plot to plotly
a = mpl_to_plotly(mpl_fig)
a.write_html("test.html", full_html=False, include_plotlyjs='cdn', include_mathjax='cdn')

If you give me some guidance, I could try to come up with an PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed type / bug Issue type: something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants