Commit 095307f
committed
Tweak AnnotationBbox coords specification.
In AnnotationBbox, it makes sense to allow passing xycoords and
boxcoords positionally, because (similarly to annotate()) something like
`AnnotationBbox(box, xy1, xy2, "axes transform", "offset points")` (for
example) actually reads better than
`AnnotationBbox(box, xy1, xy2, xycoords="axes transform", boxcoords="offset points")`
once you've seen this often enough and learn that the positional order
is just (annotated_xy, box_xy, annotated_coords, box_coords). (The
alternative that's fully explicit would be
`AnnotationBbox(box, xy=xy1, xybox=xy2, xycoords=..., boxcoords=...)`
but even that doesn't read too well because the xy kwargs names don't
rhyme exactly with the coords names; or one could reorder the args to
`AnnotationBbox(box, xy=xy1, xycoords=..., xybox=xy2, boxcoords=...)`,
but that's really a mouthful and doesn't help API usability.)
So let's just allow passing the coordinate systems positionally
(undoing the change in Matplotlib 3.6 that made them kwonly). The
following kwargs do remain kwonly, though.
In demo_text_path: xycoords defaults to "data" so doesn't need to be
specified; xybox is not specified so boxcoords is not needed.1 parent 5f25d20 commit 095307f
File tree
3 files changed
+3
-9
lines changed- galleries/examples/text_labels_and_annotations
- lib/matplotlib
3 files changed
+3
-9
lines changedLines changed: 1 addition & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 116 | + | |
121 | 117 | | |
122 | 118 | | |
123 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1224 | 1224 | | |
1225 | 1225 | | |
1226 | 1226 | | |
1227 | | - | |
1228 | | - | |
1229 | | - | |
| 1227 | + | |
1230 | 1228 | | |
1231 | 1229 | | |
1232 | 1230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
244 | 243 | | |
245 | 244 | | |
246 | 245 | | |
| |||
252 | 251 | | |
253 | 252 | | |
254 | 253 | | |
| 254 | + | |
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| |||
0 commit comments