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

[BUG] Plots do not render from in html when exported .ipynb to .html #482

Open
luboshanus opened this issue Oct 20, 2022 · 4 comments
Open

Comments

@luboshanus
Copy link

Hi, (transferring here from Plots.jl, also asked at discourse)

when I export a julia notebook .ipynb to html it does not export GR.jl-created images well. They show in html as a svg code but are not well rendered. With PyPlot.jl figures show in .html as expected figures/plots.

I don’t know if the problem is with GR.jl, IJulia, or something within Jupyter-lab as nbconverter.

Using Julia 1.6.7

  [28b8d3ca] GR v0.69.5
  [7073ff75] IJulia v1.23.3
  [91a5bcdd] Plots v1.35.4

HTML file:
Screen Shot 2022-10-20 at 16 00 15

Notebook:
Screen Shot 2022-10-20 at 16 00 24

  [28b8d3ca] GR v0.69.5
  [7073ff75] IJulia v1.23.3
  [91a5bcdd] Plots v1.35.4

Output of versioninfo():

Julia Version 1.6.7
Commit 3b76b25b64 (2022-07-19 15:11 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin21.4.0)
CPU: Intel(R) Xeon(R) W-2150B CPU @ 3.00GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake-avx512)

also in:

Julia Version 1.8.2
Commit 36034abf260 (2022-09-29 15:21 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin21.4.0)
CPU: 20 × Intel(R) Xeon(R) W-2150B CPU @ 3.00GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, skylake-avx512)
Threads: 1 on 20 virtual cores
@jheinen
Copy link
Owner

jheinen commented Oct 21, 2022

This is not a problem in GR. Even simple SVGs can't be exported to HTML with recent notebook/nbconvert releases.

image

@luboshanus
Copy link
Author

Thanks. So, the solution for now is to downgrade notebook/nbconvert?

@jheinen
Copy link
Owner

jheinen commented Oct 21, 2022

I'm afraid so. But I don't know how many versions you have to go back.
As a workaround, you can use using GR; inline("png") ...

@JBlaschke
Copy link

JBlaschke commented Oct 25, 2022

Downgrading nbconvert didn't work for me (might be because I'm trying to create slides with Reveal.jl). What ended up doing the trick (thanks to jupyter/nbconvert#1836 (comment)) is was editing the base template located at: <installation prefix>/share/jupyter/nbconvert/templates/lab:

$ diff base.html.j2.old base.html.j2
166c166
< {{ output.data['image/svg+xml'].encode("utf-8") | clean_html }}
---
> {{ output.data['image/svg+xml'] }}

This will at least render the svg correctly until the folks over at jupyter/nbconvert#1849 have fixed nbconvert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants