diff axPos.m @ 135:8979d81515ac

Added a function for printing the axes positions of a subplot grid.
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 08 Feb 2016 17:52:23 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/axPos.m	Mon Feb 08 17:52:23 2016 +0100
@@ -0,0 +1,26 @@
+function axPos(n,m)
+    a = {};
+    aPos = [];
+    for i = 1:n*m
+        a{i} = subplot(n, m, i);
+        aPos(i,:) = a{i}.Position;
+    end
+
+    dx = aPos(1,3);
+    dy = aPos(1,4);
+
+    x = unique(aPos(:,1));
+    y = unique(aPos(:,2));
+
+
+    fprintf('dx: %f\n', dx);
+    fprintf('dy: %f\n', dy);
+
+    fprintf(' x: ');
+    fprintf('%f ', x);
+    fprintf('\n');
+
+    fprintf(' y: ');
+    fprintf('%f ', y);
+    fprintf('\n');
+end