If I read your correctly, for l, b in zip(x, y):
# And here I work with data coordinates (!) dashBox = Bbox.from_bounds(l, b, width+5, height+5) badness = 0 for line in lines: if line.intersects_bbox(dashBox): badness += 1 x, y (therefore l, b) in data coordinate. width, height?? this seems to be some wx specific coordinate, i have no idea. lines (therefore line) in display coordinate. converting x,y to display coordinate should straight forward. But I'm not sure what kind of coordinate width and height has. Is it a method of some class derived from matplotlib's Text?? If then, the extent of the text can be measured using the get_window_extent method. This requires a renderer instance, which should be known if the method is called during the drawing time. Again, post a complete but simple(!) code. -JJ On Sat, Feb 27, 2010 at 8:59 PM, Andrea Gavana <andrea.gav...@gmail.com> wrote: > On 28 February 2010 01:18, Jae-Joon Lee wrote: >> On Sat, Feb 27, 2010 at 12:29 PM, Andrea Gavana <andrea.gav...@gmail.com> >> wrote: >>> This code is not doing anything useful as I always get a badness of 0, >>> although I can see that the new text overlaps quite a lot of other >>> artists. >>> >>> Does anyone have some suggestion on how to improve the code? >>> >> >> A snippet of code seldom helps. >> Is your x,y input in display coordinates? > > No, data values. > >> Ideally, this must be checked in the drawing time (as in the legend). > > This is what I am trying to do, but I messed up screen/data/canvas > coordinates and I can't get my head around it :-( > > Andrea. > > "Imagination Is The Only Weapon In The War Against Reality." > http://xoomer.alice.it/infinity77/ > http://thedoomedcity.blogspot.com/ > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users