diff scripts/plot/__go_draw_axes__.m @ 10532:568c7c041fac

colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
author Ben Abbott <bpabbott@mac.com>
date Mon, 19 Apr 2010 07:22:30 -0400
parents 6a2e4e464d38
children 95c3e38098bf
line wrap: on
line diff
--- a/scripts/plot/__go_draw_axes__.m
+++ b/scripts/plot/__go_draw_axes__.m
@@ -46,12 +46,13 @@
     endif
 
     nd = __calc_dimensions__ (axis_obj);
-    pos = axis_obj.position;
-    pos = pos - implicit_margin([1, 2, 1, 2]).*[1, 1, -0.5, -0.5];
+    if (strcmpi (axis_obj.plotboxaspectratiomode, "manual"))
+      pos = __actual_axis_position__ (axis_obj);
+    else
+      pos = axis_obj.position;
+      pos = pos - implicit_margin([1, 2, 1, 2]).*[1, 1, -0.5, -0.5];
+    endif
     if (__gnuplot_has_feature__ ("screen_coordinates_for_{lrtb}margin"))
-      if (strcmpi (axis_obj.plotboxaspectratiomode, "manual"))
-	pos = __actual_axis_position__ (axis_obj);
-      endif
       if (nd == 2)
 	x = [1, 1];
       else
@@ -72,8 +73,8 @@
       fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2));
       fprintf (plot_stream, "set size %.15g, %.15g;\n", pos(3), pos(4));
 
-      if (strcmpi (axis_obj.plotboxaspectratiomode, "manual"))
-        r = axis_obj.plotboxaspectratio;
+      if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
+        r = axis_obj.dataaspectratio;
         fprintf (plot_stream, "set size ratio %.15g;\n", -r(2)/r(1));
       else
         fputs (plot_stream, "set size noratio;\n");