SF.net SVN: matplotlib:[5881] trunk/matplotlib/lib/matplotlib/quiver.py

jdh2358@...189... wrote:

Revision: 5881
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5881&view=rev
Author: jdh2358
Date: 2008-07-25 23:54:37 +0000 (Fri, 25 Jul 2008)

Log Message:
-----------
added set_figure method for quiverkey

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/quiver.py

Modified: trunk/matplotlib/lib/matplotlib/quiver.py

--- trunk/matplotlib/lib/matplotlib/quiver.py 2008-07-25 23:52:46 UTC (rev 5880)
+++ trunk/matplotlib/lib/matplotlib/quiver.py 2008-07-25 23:54:37 UTC (rev 5881)
@@ -296,7 +296,7 @@
     quiverkey_doc = _quiverkey_doc
      def set_figure(self, fig):
- Artist.set_figure(self, fig)
+ martist.Artist.set_figure(self, fig)
         self.text.set_figure(fig)
  class Quiver(collections.PolyCollection):

This looks incomplete--shouldn't the QuiverKey initializer be using this function to set the figure from Q.ax.figure, and then should be using self.figure to get the transform?

I don't want to jump in if you are in the middle of working with it, though. I don't know what your motivation for adding this function was.

Eric

All artists which contain other artists (eg QuiverKey contains a Text
instance) should override set_figure to pass the figure on to the
childen (we should have an ArtistContainer base class to facilitate
stuff like this). When we later call ax.add_artist(quiverkey), the ax
instance will call quiverkey.set_figure so the figure will get passed
down to the Text. I needed to get the figure instance set on the text
instance because the Text prop key method was using the renderer dpi
instance in the cache key, and renderer.dpi no longer exists. Now I
am not nearly as familiar with QuiverKey as you are, but this was just
a simple fix to make sure the quiverkey text instance gets its figure
set. If it appears to you that something is still missing, please
clarify.

JDH

···

On Fri, Jul 25, 2008 at 7:02 PM, Eric Firing <efiring@...229...> wrote:

This looks incomplete--shouldn't the QuiverKey initializer be using this
function to set the figure from Q.ax.figure, and then should be using
self.figure to get the transform?

I don't want to jump in if you are in the middle of working with it, though.
I don't know what your motivation for adding this function was.

John Hunter wrote:

···

On Fri, Jul 25, 2008 at 7:02 PM, Eric Firing <efiring@...229...> wrote:

This looks incomplete--shouldn't the QuiverKey initializer be using this
function to set the figure from Q.ax.figure, and then should be using
self.figure to get the transform?

I don't want to jump in if you are in the middle of working with it, though.
I don't know what your motivation for adding this function was.

All artists which contain other artists (eg QuiverKey contains a Text
instance) should override set_figure to pass the figure on to the
childen (we should have an ArtistContainer base class to facilitate
stuff like this). When we later call ax.add_artist(quiverkey), the ax
instance will call quiverkey.set_figure so the figure will get passed
down to the Text. I needed to get the figure instance set on the text
instance because the Text prop key method was using the renderer dpi
instance in the cache key, and renderer.dpi no longer exists. Now I
am not nearly as familiar with QuiverKey as you are, but this was just
a simple fix to make sure the quiverkey text instance gets its figure
set. If it appears to you that something is still missing, please
clarify.

Thanks for the explanation. The change I had in mind would not hurt, but it would not help, either, so we'll leave it out.

Eric