changeset 11185:5b48695f3c13

Making 'axis equal' equivalent to 'daspect([1,1,1])'
author Konstantinos Poulios <logari81@googlemail.com>
date Wed, 03 Nov 2010 11:11:47 +0100
parents d9a8a008c116
children f72e17e70378
files scripts/ChangeLog scripts/plot/axis.m
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Wed Nov 03 11:09:02 2010 +0100
+++ b/scripts/ChangeLog	Wed Nov 03 11:11:47 2010 +0100
@@ -1,3 +1,7 @@
+2010-11-03  Konstantinos Poulios  <logari81@googlemail.com>
+
+	* plot/axis.m: Making 'axis equal' equivalent to 'daspect([1,1,1])'.
+
 2010-11-03  Konstantinos Poulios  <logari81@googlemail.com>
 
 	* plot/private/__actual_axis_position__.m: Remove temporary
--- a/scripts/plot/axis.m	Wed Nov 03 11:09:02 2010 +0100
+++ b/scripts/plot/axis.m	Wed Nov 03 11:11:47 2010 +0100
@@ -182,13 +182,15 @@
     elseif (strcmpi (ax, "square"))
       set (ca, "plotboxaspectratio", [1, 1, 1]);
     elseif  (strcmp (ax, "equal"))
-      x = xlim;
-      y = ylim;
       if (strcmp (get (get (ca, "parent"), "__backend__"), "gnuplot"))
         ## FIXME - gnuplot applies the aspect ratio activepostionproperty.
         set (ca, "activepositionproperty", "position");
+        ## The following line is a trick used to trigger the recalculation of 
+        ## aspect related magnitudes even if the aspect ratio is the same
+        ## (useful with the x11 gnuplot terminal after a window resize)
+        set (ca, "dataaspectratiomode", "auto");
       endif
-      set (ca, "plotboxaspectratio", [(x(2)-x(1)), (y(2)-y(1)), 1]);
+      set (ca, "dataaspectratio", [1, 1, 1])
     elseif (strcmpi (ax, "normal"))
       set (ca, "plotboxaspectratio", [1, 1, 1])
       set (ca, "plotboxaspectratiomode", "auto");