Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
I useFancyArrowPatch
a lot to make diagrams and they have a lot of arrows and I'd really liketikz-like positioning of labels along the arrow. Thearrow demo has an example of the sort of manual work that goes into trying to position each label correctly and it'd be nice to move all that positioning logic inside a method onFancyArrowPatch
.
(Discussion of migrating arrow to vector and therefore FancyArrowPatch so it could take advantage is at#22435)
For this method, we can reuse the 'ha' and 'va' arguments relative to the line, w/ n additional offset argument (here relpos, but possibly something closer to the annotate api offset(xoffset, yoffset))
ar=FancyArrowPatchar.set_label(str,offset=ratioonintervalofline,pad)#base off tikz api
left | right | center (default) |
---|---|---|
label -----> | -----> label | --label--> |
top | bottom | center (default) |
---|---|---|
label | -----> | --label--> |
-----> | label |
relpos=0 | relpos=1 | relpos=.5 (default) |
---|---|---|
label-----> | ----->label | ---label---> |
maybe |--a1--[bbox]--a2-->
Originally posted by@story645 in#22223 (comment)
ETA: Based on the discussion below, where I've landed is that an.annotate
method on artist would give me the bookkeeping I want - ease of keeping track of which annotation I put on what-and be fairly generalizable.
defannotate(self,label=None,xy=None,xytext=None,**annotation_kwargs):matplotlib.text.Annotation(text,xy,xytext,xycoords=self,**kwargs)
with annotations I guess added as child artists/sibling artists -> do we have a mechanism for this?