From: Christopher B. <Chr...@no...> - 2006-01-31 22:49:29
|
Eric Firing wrote: >> I'm having problems with the data limits when I use a LineCollection >> >> Here is the relevant code. A VectorLinecollection is a subclass of >> LineCollection. ax is an Axes instance. >> >> ax.clear() >> VLC = VectorLineCollection(t, y, theta, self.Figure, ax) >> ax.add_collection(VLC) >> ax.plot(t, y, 'o') >> print "The lines are:", ax.get_lines() >> print "AutoScaleOn:", ax._autoscaleon >> print ax.dataLim.intervaly() >> print ax.dataLim.intervaly().get_bounds() >> ax.autoscale_view() >> > It is not entirely clear to me what you mean by "call it again...", Sorry about that. this code is in a method, and when I call that method again, it gets re-run, but with different data. What I want to happen is for the axis to auto-scale to the new data. > but > note that autoscale_view() updates the viewLim from the dataLim; it does > not update the dataLim. exactly. That's why I've printed ax.dataLim.intervaly().get_bounds(). dataLim is not getting updated each time this code is run. > That is done by add_line, which is called by > plot, It looks like it should first get updated by the axes,.clear() call, then updated again each time you add something to the axes. > but it is not done by add_collection, as far as I can see. except that it works fine the first time this code is run: add_collection seems to update dataLim, but the clear call doesn't clear it out again. In this case, the problem is that I run this code with large data, the axis limits get set to large values. then I run it again with smaller values data, and the axis limits stay large, even after calling clear() and autoscale_view(). > axes methods for updating dataLim are: I saw those, but I don't know where they are getting called. most importantly, I don't know what is happening to dataLim in a clear() call, but it doesn't seem to be working right. Maybe I'll try to make a small sample that demonstrates the issue. stay tuned. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |