1 Jul 04:10
Re: dataLim and getting the data from `scatter` (bonus: an attempt at a Frame class)
On Sun, Jun 29, 2008 at 6:10 PM, Tony S Yu <tonyyu@...> wrote: > Hi. A couple of questions about `scatter`: > Q1 > ==== > The bounding box `axes.dataLim` increases in size when calling scatter(x, y) > compared to plot(x, y) (for the same x, y data, of course). I think this > change is due to the size of the markers being added to the data limits (not > sure if this is true). Is there an easy way to get the same data limits I > would have for a call to `plot`? I think your explanation is correct (the size of the markers are included in scatter (and patches in general) but not for plot (and lines in general). There is no *easy* way, but you could maintain your own bbox instance and update it in the same way the Axes._update_datalim* methods do. (See Axes._update_patch_limits and Axes._update_line_limits for example) > Q2 > ==== > Is there a way to get the data from the axes of a scatter plot? > Initially I thought I could get it with: >>>> for collection in ax.collections: >>>> for path in collection._paths: >>>> print path.vertices > But this seems to be the path that draws the scatter markers. Any ideas? The "offsets" of the collection are the x and y locs, and the vertices are the marker path, as you observed. We do not have a "publicly accessible" api for accessing the offsets (they are stored as col._offsets where col is the collection instance), but you could add(Continue reading)
RSS Feed