# Rectangles with position in data coords and width in axes coords

Hi,

I want to draw a rectangle whose center is at given x,y coords (data
coords), but whose width is in axes coords. The goal is to rewrite
boxplot so that if the scaling changes etc, the boxes will stay the
same width but their x and y positions will adjust accordingly.

Does anyone have a good idea of how to start implementing this? I
realized my initial idea of using a blended transform will not work,
because both x and y positions need to be data coords, while only the
width needs to be measured in axes coords. Perhaps it's possible to
specify the width of a rectangle in pixels/points/etc? Any
suggestions are welcome...

Thanks!
Uri

···

--
Uri Laserson
PhD Candidate, Biomedical Engineering
Harvard Medical School (Genetics)
Massachusetts Institute of Technology (Mathematics)
phone +1 917 742 8019
laserson@...1166...

Uri Laserson wrote:

Hi,

I want to draw a rectangle whose center is at given x,y coords (data
coords), but whose width is in axes coords. The goal is to rewrite
boxplot so that if the scaling changes etc, the boxes will stay the
same width but their x and y positions will adjust accordingly.

Does anyone have a good idea of how to start implementing this? I
realized my initial idea of using a blended transform will not work,
because both x and y positions need to be data coords, while only the
width needs to be measured in axes coords. Perhaps it's possible to
specify the width of a rectangle in pixels/points/etc? Any
suggestions are welcome...

You could use (perhaps subclass) a RegularPolyCollection; collections allow one to give positions as offsets using a different transform than is used for the collection items.

bar() probably should also be reimplemented using collections.

Eric

···

Thanks!
Uri