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

plot_directive: Avoid warning if plot_formats doesn't contain 'png' #13633

Merged
merged 1 commit into from Mar 9, 2019

Conversation

mgeier
Copy link
Contributor

@mgeier mgeier commented Mar 8, 2019

PR Summary

When using matplotlib.sphinxext.plot_directive in Sphinx and for example using this setting:

plot_formats = ['svg', 'pdf']

... or anything without 'png' for that matter, I get a warning for each plot:

WARNING: image file not readable: _build/plot_directive/index-1.png

This is caused by the texinfo section in the template, which seems to expect a .png file no matter what.

This PR includes the PNG image only if PNG is among the chosen formats.

This is the same fix as #3530 did to fix issue #2800 for the PDF case.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@tacaswell tacaswell modified the milestones: v3.1.0, v3.2.0 Mar 9, 2019
@tacaswell tacaswell merged commit 5cbff83 into matplotlib:master Mar 9, 2019
@mgeier mgeier deleted the plot_directive-png-warning branch March 9, 2019 09:52
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

Successfully merging this pull request may close these issues.

None yet

3 participants