question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Images saved outside of pyplot are not picked up in the gallery

See original GitHub issue

It looks like sphinx-gallery only picks up on an image if it is saved via pyplot. I’m working with a library that uses matplotlib for plotting but does not use pyplot, instead wrapping matplotlib’s object oriented interface.

It would be nice if in addition to intercepting images saved via pyplot there was also a scan for .png files in the directory that executes a given script. That way tools that generate images independent of matplotlib.pyplot will still be able to include images in a gallery.

If this is an agreeable feature to add I’d be happy to take a shot at adding it. Also if my description isn’t clear I can take a shot at making a minimal reproducible example.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:24 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
choldgrafcommented, Mar 11, 2017

This is related to a conversation I had with some of the pycortex people, who were in need of functionality to grab rst image directives in lieu of any interactively plotted viz. E.g., if you wanted to demo something that was inherently interactive but included a sample screenshot in the demo by linking to a PNG file, that image would be shown in the gallery if no other pyplot calls were made.

0reactions
larsonercommented, Apr 3, 2019

Closing this as the use case seems to be addressed by our new scraping API, feel free to reopen if I’m mistaken @ngoldbaum

Read more comments on GitHub >

github_iconTop Results From Across the Web

Matplotlib plot not appearing on saved png image [duplicate]
Just change the places of savefig and show methods. The problem will be solved. import numpy as np import matplotlib.pyplot as plt import ......
Read more >
Saving plots - Problem Solving with Python
Matplotlib plots can be saved as image files using the plt.savefig() function. The plt.savefig() function needs to be called right above the plt.show()...
Read more >
Working with Images in Python using Matplotlib - GeeksforGeeks
The image module in matplotlib library is used for working with images in Python. The image module also includes two useful methods which...
Read more >
matplotlib.pyplot.savefig — Matplotlib 3.1.2 documentation
If format is not set, then the output format is inferred from the ... If True, indicates that this image should be stored...
Read more >
Image Processing with Python - Data Carpentry
Our image of an eight is no exception, and imageio.v3 stored that image data ... to gain a conceptual understanding of the images...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found