[Matplotlib-users] Problem with cachedRenderer

Hi Tony,

thanks for your reply! I am not using the pdf backend, but the

GTKAgg backend. Is it working with this backend in the development
version?

Cheers

Andi

Hi Andi,

Unfortunately, I can’t run the GTKAgg backend, but I checked your code snippet on the backends I have on my system. It seems this behavior is really inconsistent:

Works:

  • agg
  • qt4agg
  • tkagg

Doesn’t work:

  • pdf
  • macosx

To be honest, I don’t understand the magical workings of the backends very well. I’ve copied the developer list since the consistency of backends seems like a relevant issue.

-Tony

P.S. Andi: Be sure to “reply all” since the mailing list doesn’t automatically do this for some reason.

···

On Wed, Jan 25, 2012 at 7:14 AM, andi <andisspam@…564…> wrote:

On 25/01/12 00:26, Tony Yu wrote:

On Tue, Jan 24, 2012 at 12:53 PM, andi <andisspam@…564…> > > wrote:

Hi all,

      I have some old custom code for generating videos from

matplotlib (not

      using the animation module). It used to work, but is now

failing.

      Here is what I am doing:



      -------------------

      import matplotlib.pyplot as plt

      import numpy as np



      fig = plt.figure()

      ax = fig.add_subplot(111)

      im = ax.imshow(np.zeros((100, 100)))

      fig.canvas.draw()

      ax.draw_artist(im)

      ------------------



      ... and draw_artist from axes.py then gives me an

AssertionError because

      no renderer is found (assert self._cachedRenderer is not

None).

      Right now I am using matplotlib 1.0.1 and I think that the

above used to

      work with older versions in matplotlib. See e.g.

      [http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg06598.html](http://www.mail-archive.com/matplotlib-users@...1052...rceforge.net/msg06598.html)



      Any ideas?



      Cheers

      Andi
      Hi Andi,



      I'm running a development version of matplotlib, and your code

runs without issue. That doesn’t really solve your issue, but
it means that it’s not due to deprecation.

      On a hunch, I tried running the code with

      >>> import matplotlib

      >>> matplotlib.use('pdf')

      at the top of the file, and I got the same error. Not really

sure why, though. Do you happen to have the pdf backend set as
the default?

      -Tony