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
Download as PDF or Tex does not work with images created inline using %matplotlib notebook #10380
Comments
attn @mpacer what is the canonical location for nbagg + saving notebooks not play well together? If you do |
I tested with |
I think the issue is that there is no canonical location since the issue could arise in either library. My intuition is that here for some reason it’s seeing a repr_latex that isn’t doing what we would expect and is dumping the text repr of the object. I think in this case it may be a matplotlib bug. I think the right way to handle this would be to include a repr_png repr_jpeg or repr_latex with a link to the base64 encoded static image. Since the nbagg keeps a channel open to handle updates, you might want to assign these values when the channel is closed. The issue is that when exporting to LaTeX we can’t really deal with either html or JavaScript and converting to PDF happens via LaTeX. |
I am facing the same issue, any solution? |
@ghayth82 not directly, but the right place to follow the follow-on to this issue is matplotlib/ipympl#16 |
I don’t think those are the same. That issue refers to the new widgets backend. This issue is using nbagg. |
But in both cases the underlying cause is the widget protocol not being quite rich enough or not specified enough for our needs (or we are just using it wrong). Long term we want to deprecate notebook in favor of ipympl so if we are going to fix it one place we should fix it over there. |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
Bug report
(Originaly raised as jupyter/notebook#3295 Though there is some lack of clarity about which parts of Jypyter are managed where - perhaps this itself is a bug?)
Issue:
Download as PDF or Tex does not work with images created inline using %matplotlib notebook
If you create images (graphs etc) using the %matplotlib notebook magic then images created inline are not rendered in Tex or PDF output.
Instead the images is replaced with
<IPython.core.display.Javascript object>
<IPython.core.display.HTML object>
The suggested workround of replacing %matplotlib notebook with %matplotlib inline before using 'Download as' is not convienient as it does not work in all cases.
For example (given below) the figure.set_size_inches methods produces different results.
Also, any dynamic runtime changes to the plots (zoom, pan, etc) are not possible when using inline.
Example code to reproduce the issue
File -> Download As -> PDF (Via LaTeX)
This issue is also discussed here:
https://stackoverflow.com/questions/35305607/jupyter-notebook-matplotlib-figures-missing-in-exported-pdf
Actual outcome
A PDF document containing code but no pictures
Expected outcome
A PDF document containing code and pictures
Matplotlib version
print(matplotlib.get_backend())
): nbAggPython was installed as msi from Python website
Everything else installed through pip
The text was updated successfully, but these errors were encountered: