JerryI / wolfram-js-frontend

Dynamic Notebook Environment for Wolfram Language written in Javascript
https://jerryi.github.io/wljs-docs/
GNU General Public License v3.0
262 stars 10 forks source link

AxesLabel issues #216

Open LoganJFisher opened 2 months ago

LoganJFisher commented 2 months ago

Describe the bug When using Plot[] with an AxesLabel argument, the plot isn't displayed. When using Plot3D[] with an AxesLabel argument, the axes labels aren't displayed.

To Reproduce Plot[Sinc[x], {x, 0, 10}, AxesLabel -> Sinc[x]]

Plot3D[Sin[[Theta] [Rho]], {[Theta], 0, 3}, {[Rho], 0, 3}, AxesLabel -> Automatic]

Examples taken from here.

Expected behavior Plot Plot3D

Screenshots 3neZDe7

Desktop (please complete the following information):

JerryI commented 2 months ago

First example won't work in WLJS, since it uses only plain string (or latex like expressions for subscript or superscript) for all kind of labels on plots

the working solution

Plot[Sinc[x], {x, 0, 10}, AxesLabel -> "Sinc[x]"]

The second one is indeed a bug

JerryI commented 1 month ago

Added in a new release of wljs-grapics3d-threejs (will be updated automatically)

Screenshot 2024-07-29 at 16 06 17

gganapat commented 1 week ago

Hi, to get a more complete set of options through Wolfram Plot options, I tried exporting and re-importing the png files. It works very well with Plot3D but not for plain Plot. Any recommendations to get the original Plot to work also? Perhaps through a another wrapper to the Wolfram version?

Screenshot 2024-08-28 at 9 21 28 AM

Thanks!

JerryI commented 1 week ago

Hi, to get a more complete set of options through Wolfram Plot options, I tried exporting and re-importing the png files. It works very well with Plot3D but not for plain Plot. Any recommendations to get the original Plot to work also? Perhaps through a another wrapper to the Wolfram version?

Thanks!

Hi @gganapat ! I found a solution

Unprotect[Annotation];
Annotation[x_, _, "DynamicHighlight"] := x 
Protect[Annotation]
Screenshot 2024-08-28 at 21 30 34

Something went wrong with DynamicHeight, which anyways is not used in WLJS I will merge this code with a core package

JerryI commented 1 week ago

merged in commit

gganapat commented 1 week ago

Great! Thx! gani-

gganapat commented 1 week ago

The mod works very well, but still have some issues. While trying to reproduce this approach with Style, it didn't work. See below --

Screenshot 2024-08-28 at 4 20 22 PM

Any suggestions? Thanks!

JerryI commented 4 days ago

The mod works very well, but still have some issues. While trying to reproduce this approach with Style, it didn't work. See below --

Any suggestions? Thanks!

It seems that we can either support normal syntax for equations and syntax sugar or fully support native functions like Export. With some inverse engineering , it turned out that when you export graphics it also relies on StandardForm output, which we had to alter.

I believe this is never winning war between two architectures. I would suggest to make a list of options, which you are missing in our implementation of Plot, Plot3D and etc. Then we could go one by one (firstly starting with the prioritized) and in the end you wound not need anymore a standard export from Mathematica.

JerryI commented 4 days ago

merged in commit

I had to roll it back, since it breaks BarPlot :( I don't know why, it seems it somewhat internal, that only devs of Wolfram Kernel know

gganapat commented 3 days ago

Ok, thanks! On another note, how do I make a contribution (will PayPal work?). I believe you are making a significant contribution to the open-source community and I would like to acknowledge that with a small monetary contribution. I have Mathematica 14.0 and can also call into the WolframEngine 14.1, but I think you have done something significant and want to give a big shoutout.

Gani --

JerryI commented 3 days ago

Ok, thanks! On another note, how do I make a contribution (will PayPal work?). I believe you are making a significant contribution to the open-source community and I would like to acknowledge that with a small monetary contribution. I have Mathematica 14.0 and can also call into the WolframEngine 14.1, but I think you have done something significant and want to give a big shoutout.

Gani --

Thank you for your kind words, Gani 😌 I hope that someday we can fix these annoying bugs and WLJS can become more useful to the community. We recently contacted the developers of Mathematica, they might help us to find some solutions.

Yes, you can use any method you prefer. There’s a PayPal link in the README.md, as well as GitHub sponsorship. We appreciate any amount.

JerryI commented 3 days ago

Please also join the discussion #275