plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
17.06k stars 1.86k forks source link

Latex doesn't render in 3d axis titles #608

Open yankev opened 8 years ago

yankev commented 8 years ago

It only appears to render in the legend. Demo: https://jsfiddle.net/60eqc0xz/7/

etpinard commented 8 years ago

A known limitation of using WebGL for 3D plots.

Won't be fixed any time soon.

parthi2929 commented 6 years ago

This is still not fixed? It has been 2 years. Kindly plan to support.

yaozhewei commented 5 years ago

Has there been any updates on this feature?

Koushikphy commented 5 years ago

It's really unfortunate that 3d plot does not support latex renderig. For the mean time, is it possible to use unicode/html entity in place of latex like instead of giving $\rho$, can't we just give ρ or ρ

Koushikphy commented 5 years ago

Well it works if directly putting rho from copy pasting it somewhere like ρ

Catarina-Alves commented 4 years ago

I would like to have this feature and I can contribute so it is done. Is it very hard to do? What are the problems encountered? If anyone has looked at this, can you give me an overview or point me to the place to look at so I can check if I am able to help?

archmoj commented 4 years ago

@Catarina-Alves thanks very much! For rendering text using webgl @mikolalysenko's vectorize-text is called .

I think if one converts Latex to pixel data, then it could be used here https://github.com/mikolalysenko/vectorize-text/blob/18c472de123e7ea7ea25ec80b7ac15b2ea0540c4/lib/vtext.js#L310. But I may be wrong.

cc: @antoinerg @alexcjohnson

Catarina-Alves commented 4 years ago

Thank you @archmoj. I will have a look at your resources and the code and see if it is within my knowledge to make the necessary changes.

christian-nils commented 4 years ago

@Catarina-Alves, any chances you would have come up with a solution?

Catarina-Alves commented 4 years ago

I have looked through this but I do not have the right skills to solve this issue. I am sorry.

jackparmer commented 4 years ago

This issue has been tagged with NEEDS SPON$OR

A community PR for this feature would certainly be welcome, but our experience is deeper features like this are difficult to complete without the Plotly maintainers leading the effort.

What Sponsorship includes:

Please include the link to this issue when contacting us to discuss.

alexcjohnson commented 8 months ago

For those still interested in this issue, the crux is that 3D plots currently draw everything in WebGL, including the text. Up in https://github.com/plotly/plotly.js/issues/608#issuecomment-600920777, @archmoj proposed one way to solve this, by rasterizing the LaTeX. Another way (which is more akin to what we did with 2D WebGL plots) would be to refactor this to draw the text (ideally both titles and tick labels) in SVG instead of in WebGL. That would make it easy to support LaTeX the same way we do the rest of SVG text, and would make all of these labels higher-quality overall, particularly in vector output like PDF. Unfortunately it's a fairly major refactor, and I'm not quite sure what would be needed to pull the coordinates for all of these text items out of the stack.gl modules that handle 3D subplots and return them to our SVG drawing code.