Mercurial > repos > public > sbplib
comparison arrowAnnotation.m @ 1072:6468a5f6ec79 feature/grids/LaplaceSquared
Merge with default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 12 Feb 2019 17:12:42 +0100 |
parents | 2412f407749a |
children |
comparison
equal
deleted
inserted
replaced
1071:92cb03e64ca4 | 1072:6468a5f6ec79 |
---|---|
1 % Draw an arrow from p1 to p2, with text attached | |
2 function [h] = arrowAnnotation(p1,p2) | |
3 ah = gca; | |
4 xl = ah.XLim(1); | |
5 xr = ah.XLim(2); | |
6 | |
7 yl = ah.YLim(1); | |
8 yr = ah.YLim(2); | |
9 | |
10 dx = xr - xl; | |
11 dy = yr - yl; | |
12 | |
13 s = [ | |
14 ah.Position(1) + (p1(1) - xl)/dx*ah.Position(3), | |
15 ah.Position(1) + (p2(1) - xl)/dx*ah.Position(3), | |
16 ]; | |
17 t = [ | |
18 ah.Position(2) + (p1(2) - yl)/dy*ah.Position(4), | |
19 ah.Position(2) + (p2(2) - yl)/dy*ah.Position(4), | |
20 ]; | |
21 | |
22 h = annotation('arrow', s, t); | |
23 end |