Last active
December 17, 2015 13:59
-
-
Save runiq/5620738 to your computer and use it in GitHub Desktop.
PGF backend callback bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib | |
matplotlib.use('Agg') | |
import matplotlib.pyplot as plt | |
def on_draw(event): | |
print "on_draw!" | |
f = plt.figure() | |
f.canvas.mpl_connect('draw_event', on_draw) | |
ax = f.add_subplot(111) | |
ax.plot(xrange(10)) | |
print "Save to img.png, fires on_draw():" | |
f.savefig('img.png') | |
print "Save to img.pgf, implicit switch to PGF backend, doesn't fire on_draw():" | |
f.savefig('img.pgf') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment