Repository navigation
Cleanups to Annotation. - #25940
Cleanups to Annotation.#25940
Conversation
story645
left a comment
There was a problem hiding this comment.
Nit that I expect you'll tell me to implement in a follow up.
| 'offset points' Offset (in points) from the *xy* value | ||
| 'offset pixels' Offset (in pixels) from the *xy* value | ||
| ================= ========================================= | ||
| 'offset fontsize' Offset (relative to fontsize) from the *xy* value |
There was a problem hiding this comment.
Slightly unclear what relative to font size means here - I can do a followup on the annotations tutorial to add an offset font size example, but can this be in some form similar to "offset in x relative to font size from the xy value"
And yeah I disagree with the parenthesis here b/c in this whole chunk the unit is the important bit, would probably rework table so that the header is "value | unit of offset from xy "
There was a problem hiding this comment.
What other font size there is? This is literally in the docstring for annotate() which is about putting a text somewhere.
I did remove the parentheses, though.
I do think keeping the same header as for xycoords is better, as this table is supposed to be a continuation of the one just above.
There was a problem hiding this comment.
What I mean is what does relative to font size mean - like if I set offset to (12,12) in font size, what does that mean for how far the offset is from the text?.
There was a problem hiding this comment.
If your font size is 12pt, then 1 means "12 pt".
- Reorder logic in _get_xy_transform to make the case of xy0 not being specified (i.e. invalid bbox_name) fail more obviously. - Document "offset fontsize" option.
|
Also, I think it would be nice to a add a test for some Is |
I guess so, but I don't think e.g.
If you're thinking
At least #25905 will exercise this in building the docs; I'll skip actual tests for now... |
|
More something like: if unit == "points":
scale = self.figure.dpi / 72 # dpi/72 dots per point
elif unit == "pixels":
scale = 1.
...
return Affine2D().scale(scale).translate(*xy0) |
|
But there's the unit == "fraction" case, which is a bit ugly to also handle here. |
Fair enough. Didn't see that. |
See discussion at #25907.
PR summary
PR checklist