comparison arrowAnnotation.m @ 968:a4ad90b37998 feature/poroelastic

Merge with default.
author Martin Almquist <malmquist@stanford.edu>
date Sun, 23 Dec 2018 14:39:31 +0100
parents 2412f407749a
children
comparison
equal deleted inserted replaced
967:368a2773f78b 968:a4ad90b37998
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