Rectangles with center in data units, width/height in screen units

Hey all,

I’m trying to render a rectangle where I place its center in data units but then can choose its height and width in screen units.

As far as I can tell, this is similar to but different from:

  • scatter ing squares, as I can’t control the height and width separately
  • rect, as though this takes positions in data units and can take width/heights in screen units, the position always demarcates the top/bottom left and I need it to demarcate the center. If I could make the position a combination of a data unit position plus a screen unit offset, this would work, but I don’t see that option.
  • quad which seems to only be measured in data units
  • patch which seems to only be measured in data units

Is what I want possible?

May be covered by Add block glyph by bryevdv · Pull Request #11842 · bokeh/bokeh · GitHub, but that was only merged 4 days ago and is not yet in a release. Not sure about the screen/data unit issue.

1 Like

Thanks @James_A_Bednar1 ! The PR you linked me to didn’t address this issue, but in its discussion it made me realize that ‘rect’ does work - (x, y) for rect denote the center of the rectangle, not the corner, which is what I was looking for.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.