-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
show(::text/plain) is called even when ::text/html is defined #574
Comments
This is how Jupyter works. The kernel sends a dictionary containing multiple representations of the object, called a "mime-bundle", and the front-end selects which one to display. You can even have multiple front-ends connected simultaneously to the same kernel — one front-end might be a notebook that displays HTML, and another might be a console that displays only text. |
I believe this is a big performance trap. Typically you define your show methods for |
@KristofferC, you could cache the re-used information in a global or something, though I'm not sure what parts of LaTeX are re-used between PNG and SVG output? You could return the whole MIME bundle in one call by overloading (The basic problem here is that some backends can display either SVG or PNG, while some can only display PNG, so it is not great to send SVG without sending PNG too.) |
Everything from LaTeX is reused since both PNG and SVG are just conversions from the generated PDF. And generating the PDF is orders of magnitude more costly than converting it. Right now, I am using globals and some hashing of the latex code to try to detect when IJulia asks for the same plot twice in different formats. This seems like a bad way of doing stuff... FIgures in formats that are never shown are requested and the figure generator does not get any context that it is actually the same figure that should be rendered. My guess is that almost every package showing things in IJulia are double rendering things right now. |
How do you propose to solve this, since there is no way in the Jupyter protocol for the kernel (IJulia) to know which formats can be displayed? In PyPlot, I don't emit SVG by default, since SVG is slow to display anyway for complicated plots. |
I'm not saying IJulia is doing anything wrong, it just seems like a bad situation in general.
I expect most people that use PGFPlotsX want to have vector graphics by default since PGFPlots is slow anyway for complicated plots and I believe is often used because of the high-quality plots it produces. |
Workaround for users: use |
shows:
html WARNING: plain called
The output is correct, but why is
plain
called at all?It seems to be this line
The text was updated successfully, but these errors were encountered: