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

in a jupyter notebook: how to force Mesh display to be a png and not an svg? #7

Closed
r03ert0 opened this issue Nov 22, 2020 · 1 comment

Comments

@r03ert0
Copy link
Contributor

r03ert0 commented Nov 22, 2020

hello 👋
I'm using matplotlib-3d to display meshes inside a jupyter notebook. The meshes are ~20k vertices, and Mesh() produces very large svg files (my notebooks end up with file sizes on the ~100 MB!). Is there a way of forcing the resulting image to be a png instead of an svg? I know I can save the image as a png using plt.savefig() -- and that works great -- but I'd like somehow to replace the svg in the notebook by that png...
thank you in advance!

@r03ert0
Copy link
Contributor Author

r03ert0 commented Nov 22, 2020

I found : )
I'm adding this at the beginning:

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

Now my notebooks are all nice and tiny and with beautiful meshes :)

@r03ert0 r03ert0 closed this as completed Nov 22, 2020
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

1 participant