On 8/25/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I've written a script that animates but I can't update the x axis.  I've
> tried to scale up the bounding box but I run in to trouble with "lazy" vaues
> which I don't understand.
> Here are some snippits of

> p.gca().update_datalim_numerix((-1000,1000),(-1000,1000)
>         boundingbox=self.a.bbox  # where self. a is the axis
> #        boundingbox.scale(Value(2),Value(2))  #does not work
>         self.background = self.canv.copy_from_bbox(boundingbox)  # where
> self.canv is the canvas
> ...
>         self.canv.restore_region(self.background)
>
>
> Should I be trying to scale up the bounding box? or should I be doing
> something else?

w/o seeing more of your code, it is hard to guess what you are trying
to do, but I'll hazard a guess that this is almost certainly not the
right approach.  Modifying the lazy values directly is best left for
internal use or for very advanced mpl trickery -- I am not sure if I
have ever done it outside mpl in any of my code.  You can read more
about them in the matplotlib.transforms documentation.  Are you
working on code that someone else wrote, by chance?

ax.bbox is the rectangular region of the Axes (eg the "white" extent
of the axes) and if you wanted to change it you would use
ax.set_position([left, bottom, width, height]) which in turn would
call the "set" methods of the lazy values.

But my guess is you do not want to be modifying the axes bbox at all,
but rather the axes view limits, which sets the x and y extent of the
data coordinates.  In that case you simply need to do

  ax.set_xlim(xmin, xmax)


If you wanted to scale them by a factor of 2 as in your example, eg if
you wanted the range -3..3 to scale to -6..6, you would do

  xmin, xmax = ax.get_xlim()
  ax.set_xlim(2*xmin, 2*xmax)

If I am not barking up the right tree, please post more code and
describe in more detail exactly what you need to do...

JDH

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to