annotation arrow shrink

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

annotation arrow shrink

Phlya
Hi all,

I am trying to figure out how shrinkA works for arrows in annotations, and it seems very confusing from experimenting with it - is there an explanation somewhere online?
I simply wanted to ensure that the arrow starts at the edge of the bounding box, but it's not so easy, it seems... Is this not the right way to do this, maybe?

Thanks!

Cheers,
Ilya

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: annotation arrow shrink

vincent.adrien@gmail.com
Hi Ilya,

Using a null-value for `shrinkA` or `shrinkB` does not achieve what you
want?

FWIW, I think that the method used under the hood by `FancyArrowPatch`
is located
[here](https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/patches.py#L2706),
while the percentage-to-points machinery in `Axes.annotate` (when
*arrowstyle* is `None` and using the *shrink* parameter) seems to start
[there](https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/text.py#L2128).

Attached is a small snippet demonstrating both the percentage-based and
the point-based shrinking possibilities, in case this might help.

Best,
Adrien

On 05/29/2018 11:20 AM, Ilya Flyamer wrote:

> Hi all,
>
> I am trying to figure out how shrinkA works for arrows in annotations,
> and it seems very confusing from experimenting with it - is there an
> explanation somewhere online?
> I simply wanted to ensure that the arrow starts at the edge of the
> bounding box, but it's not so easy, it seems... Is this not the right
> way to do this, maybe?
>
> Thanks!
>
> Cheers,
> Ilya
>
>
> _______________________________________________
> Matplotlib-users mailing list
> [hidden email]
> https://mail.python.org/mailman/listinfo/matplotlib-users
>

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

shrink_playground.py (1K) Download Attachment
shrink_playground.png (20K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: annotation arrow shrink

Phlya
Thanks Adrien,

This is very helpful and pointed me towards a mistake I had made, thank you!

I am still not sure why sometimes arrows of my annotations would start from the middle of the text and are not clipped, but I can't reproduce it in simple examples, so have to presume it's some strange side effect from my other code.

Best,
Ilya

2018-05-29 23:21 GMT+01:00 [hidden email] <[hidden email]>:
Hi Ilya,

Using a null-value for `shrinkA` or `shrinkB` does not achieve what you want?

FWIW, I think that the method used under the hood by `FancyArrowPatch` is located [here](https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/patches.py#L2706), while the percentage-to-points machinery in `Axes.annotate` (when *arrowstyle* is `None` and using the *shrink* parameter) seems to start [there](https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/text.py#L2128).

Attached is a small snippet demonstrating both the percentage-based and the point-based shrinking possibilities, in case this might help.

Best,
Adrien


On 05/29/2018 11:20 AM, Ilya Flyamer wrote:
Hi all,

I am trying to figure out how shrinkA works for arrows in annotations, and it seems very confusing from experimenting with it - is there an explanation somewhere online?
I simply wanted to ensure that the arrow starts at the edge of the bounding box, but it's not so easy, it seems... Is this not the right way to do this, maybe?

Thanks!

Cheers,
Ilya


_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users



_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users



_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users