A collection of axvspan ?

All,
I need to plot stripes of different widths at different locations along the x
axis, but spanning the whole range of y data. Using axvspan in a loop works
quite fine. However, I was wondering whether it wouldn't be more efficient to
build a PatchCollection.
BrokenBarHCollection could be a candidate, but I have trouble figuring how to
force the bars to span the whole range of y: is it possible to force the
ordinates to axes coordinates ?
Thanks a lot in advance for any idea/comment
P.

You could use this if you pass in a custom blended transform -- see
the src for axhspan and axvspan to see how it creates the blended
transform (blend of xaxis and yaxis transform) and just pass this off
to the bar collection.

Let me know if you need any help.

JDH

···

On 6/21/07, Pierre GM <pgmdevlist@...287...> wrote:

All,
I need to plot stripes of different widths at different locations along the x
axis, but spanning the whole range of y data. Using axvspan in a loop works
quite fine. However, I was wondering whether it wouldn't be more efficient to
build a PatchCollection.
BrokenBarHCollection could be a candidate, but I have trouble figuring how to
force the bars to span the whole range of y: is it possible to force the
ordinates to axes coordinates ?
Thanks a lot in advance for any idea/comment

Pierre GM wrote:

All,
I need to plot stripes of different widths at different locations along the x axis, but spanning the whole range of y data. Using axvspan in a loop works quite fine. However, I was wondering whether it wouldn't be more efficient to build a PatchCollection. BrokenBarHCollection could be a candidate, but I have trouble figuring how to force the bars to span the whole range of y: is it possible to force the ordinates to axes coordinates ?
Thanks a lot in advance for any idea/comment

I haven't tried it, but I think you can use the same trick that axvspan uses:

  trans = blend_xy_sep_transform( self.transData, self.transAxes )

where "self" in this case is the axes instance, so you would use "ax" or whatever. Then, since the collection is an artist, you can use its inherited set_transform(trans) method, and specify your x coordinates in data units and your y as 0 and 1 to span the whole vertical extent. This is assuming you want the width of your bars to be in data coordinates, not just the x-positions of their centers.

Eric

···

P.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

John, Eric,
That works like a charm ! Thanks a lot !

···

On Thursday 21 June 2007 17:15:01 Eric Firing wrote:

  trans = blend_xy_sep_transform( self.transData, self.transAxes )

where "self" in this case is the axes instance, so you would use "ax" or
whatever. Then, since the collection is an artist, you can use its
inherited set_transform(trans) method,