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

nbconvert to slides does not work with matplotlib svg #6541

Closed
tbarbette opened this issue Sep 15, 2022 · 2 comments
Closed

nbconvert to slides does not work with matplotlib svg #6541

tbarbette opened this issue Sep 15, 2022 · 2 comments
Labels
bug status:Needs Triage Applied to issues that need triage

Comments

@tbarbette
Copy link

Describe the bug
Exporting a matplotlib plot in SVG in slides (with jupyter nbconvert) does not work.

To Reproduce
The minimal ipynb:

import matplotlib.pyplot as plt
import numpy as np

from IPython.display import set_matplotlib_formats
set_matplotlib_formats('svg')

ax = plt.figure(figsize=(8, 3))

plt.grid(visible=True, axis="y", linestyle="dashed", zorder=0)

fig = plt.hist(np.random.rand(10), bins=bins, rwidth=0.9, zorder=3,density = density)
plt.show()

jupyter nbconvert md1.ipynb --execute --to slides

Expected behavior
The graph renders in jupyter, and the graph should also be visible in the html slides.

Screenshots
image

It seems the content has been sanitized or so :

<div class="jp-RenderedSVG jp-OutputArea-output " data-mime-type="image/svg+xml">
  | b'<svg width="506.928125pt" height="222.954375pt">\n \n  \n   \n    \n    2022-09-15T17:25:21.942234\n    image/svg+xml\n    \n     \n      Matplotlib v3.5.2, https://matplotlib.org/\n     \n    \n   \n  \n \n \n  <style type="text/css">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n \n \n  \n   \n  \n  \n   \n    \n   \n   \n    \n     \n      \n       \n      \n      \n       \n      \n     \n     \n      \n      \n       \n        \n       \n       \n      \n     \n    \n    \n     \n      \n       \n      \n     \n     \n      \n      \n       \n        \n       \n       \n      \n     \n    \n    \n     \n      \n       \n      \n     \n     \n      \n      \n       \n        \n       \n       \n      \n     \n

Desktop (please complete the following information):

  • OS: Ubuntu on WSL
  • Browser chrome
  • Version
Selected Jupyter core packages...
IPython          : 7.31.1
ipykernel        : 6.7.0
ipywidgets       : 6.0.0
jupyter_client   : 7.1.2
jupyter_core     : 4.9.1
jupyter_server   : not installed
jupyterlab       : not installed
nbclient         : 0.5.6
nbconvert        : 7.0.0
nbformat         : 5.1.3
notebook         : 6.4.8
qtconsole        : 5.3.2
traitlets        : 5.1.1
@RRosio
Copy link
Collaborator

RRosio commented Sep 15, 2022

Hi @tbarbette, thank you for submitting this issue! We'll track this in the nbconvert issue jupyter/nbconvert#1863

@tbarbette
Copy link
Author

Ah sorry for the duplicate !

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug status:Needs Triage Applied to issues that need triage
Projects
None yet
Development

No branches or pull requests

2 participants