Thanks. Unfortunately wx and tk backends are broken on my machine (but they may be easier to fix).
I will file a bug report for the native backend bug.
Nicolas
···
On Oct 4, 2010, at 22:27 , Friedrich Romstedt wrote:
2010/10/4 Nicolas Rougier <Nicolas.Rougier@...2073...>:
I'm trying to have animated plots using draw_artist on mac os x and I got an error with the following script:
import numpy as np
import matplotlib.pyplot as pltplt.ion()
plt.figure()
subplot = plt.subplot(1,1,1)
axis = plt.imshow(np.random.random((10,10)))
plt.draw()
subplot.draw_artist(axis)
plt.show()The traceback is:
Traceback (most recent call last):
File "matplotlib-bug.py", line 8, in <module>
subplot.draw_artist(axis)
File "/Volumes/Data/Local/lib/python2.7/site-packages/matplotlib/axes.py", line 1946, in draw_artist
a.draw(self._cachedRenderer)
File "/Volumes/Data/Local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/Volumes/Data/Local/lib/python2.7/site-packages/matplotlib/image.py", line 338, in draw
gc = renderer.new_gc()
File "/Volumes/Data/Local/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py", line 105, in new_gc
self.gc.save()
RuntimeError: CGContextRef is NULLIs there something wrong in my script (it seems to be working on linux) ?
I don't know what it is, and it looks like some problem with the
Mac-native backend, but I believe you can sort it out by just
switching the backend to e.g. TkAgg.Friedrich