-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Write Image as PDF with Box includes text "Loading [MathJax]/extensions/MathMenu.js" #3469
Comments
What Plotly version are you running? I checked your code with v 5.3.1 (the last one), and no such box is displayed. |
I have no idea why that box is displayed. It could be your browser?!!! |
It only outputs such box if I am trying to write a PDF, the browser does not have such box. One peculiar issue is that if I am going to write multiple PDF plot in one file, this box will only show in the first PDF image. |
This is pretty unfortunate. The cause is that the PDF is being generated by a browser essentially doing a print operation. If this happens while MathJax is still loading, then this box will appear in the output. @jonmmease any thoughts about how to wait a bit longer? |
Just for now, my solution is writing a random plot before my official plot. Of course, I would like to see this problem resolved if possible. |
I am having the same issue with plotly 5.4.0 and kaleido 0.2.1.post1. I suspect the issue is with the latest kaleido. |
I'm also running into this with:
Thanks for the workaround @vincentliuheyang, it works well for me. |
Same issue with exact same versions as @willfindlay. Is there any workaround? |
Thanks to @vincentliuheyang.
|
this worked for me:
plotly==5.3.1 |
Thank you! I hadn't realized it was only on the first write when running a script. Interesting. |
I am experiencing the same problem as well, do we know what causes the problem? |
Yes, we know the basic cause, see plotly/Kaleido#122 for details. Note that if the figure you're rendering doesn't actually use MathJax then you can prevent MathJax from being loaded at all by Kaleido with: import plotly.io as pio
pio.kaleido.scope.mathjax = None Otherwise, if saving a "throwaway" PDF first helps, I would recommend that: basically save your figure twice. |
Is anyone seeing this with Kaleido 0.1 ? |
I have tried to manually downgrade to kaleido 0.1 and plot my graph and the error still exist. |
An easy way around is to save as |
I have found a solution for that problem, at leas in my case it worked. Just disable the warnings on kaleido engine like this:
|
@pgvaz its probably pure luck that the message is not appearing in this case for you. When you look at the code of what you are calling here, the warn doesn't do anything but surpressing a plotly warning message that tells you you shouldn't use that function in production. |
Saving a dummy figure before the desired figure doesn't work for me. |
I think a time delay of a second may be necessary. |
Hi, I tried but it did remove the watermark, but fails to render the math any more. I need the math formula to be shown, what can I do now? @nicolaskruchten |
I am having the same issue, I have tried in Windows 10, WSL and Ubuntu... |
[NEW] added a convenience class util.pdf_writer which writes once, then sleeps for 2 seconds, then writes again. Motivated by the solution here plotly/plotly.py#3469 we only have to do this sleep once, during a session. So we create an instance of this writer and use it for all writes.
Hi,
I am trying to write plot into PDF format, but I cannot get rid of this box saying "Loading [MathJax]/extensions/MathMenu.js", will you be able to tell me how should I fix it?
Here is the code I am using to generate the plot.
The text was updated successfully, but these errors were encountered: