diff scripts/plot/colorbar.m @ 10931:a72d53df4fa6

Treatment of activepositionproperty for gnuplot.
author Ben Abbott <bpabbott@mac.com>
date Tue, 31 Aug 2010 13:23:50 -0400
parents 91ff0d7ee94b
children 9c0b366583cb
line wrap: on
line diff
--- a/scripts/plot/colorbar.m
+++ b/scripts/plot/colorbar.m
@@ -106,6 +106,10 @@
   end_unwind_protect
 
   if (! deleting)
+    ## FIXME - Matlab does not require the "position" property to be active.
+    ##         Is there a way to determine the plotbox position for the gnuplot
+    ##         backend with the outerposition is active?
+    set (ax, "activepositionproperty", "position");
     obj = get (ax);
     obj.__my_handle__ = ax;
     position = obj.position;
@@ -117,7 +121,7 @@
 
     [pos, cpos, vertical, mirror] =  ...
         __position_colorbox__ (loc, obj, ancestor (ax, "figure"));
-    set (ax, "activepositionproperty", "position", "position", pos);
+    set (ax, "position", pos);
 
     cax = __go_axes__ (get (ax, "parent"), "tag", "colorbar", 
                        "handlevisibility", "on", 
@@ -182,7 +186,8 @@
     if (!isempty (ancestor (h, "axes")) &&
         strcmp (get (ancestor (h, "axes"), "beingdeleted"), "off"))
       set (ancestor (h, "axes"), "position", orig_props.position, ...
-                                 "outerposition", orig_props.outerposition);
+                            "outerposition", orig_props.outerposition, ...
+                    "activepositionproperty", orig_props.activepositionproperty);
     endif
   endif
 endfunction
@@ -192,7 +197,8 @@
       (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off")) &&
       ishandle (get (h, "axes")))
      set (get (h, "axes"), "position", orig_props.position, ...
-                           "outerposition", orig_props.outerposition);
+                           "outerposition", orig_props.outerposition, ...
+                   "activepositionproperty", orig_props.activepositionproperty);
   endif
 endfunction
 
@@ -265,8 +271,13 @@
     else
       scale = [scale, 1];
     endif
-    obj.position = obj.position .* [1, 1, scale];
-    off = 0.5 * (obj.position (3:4) - __actual_axis_position__ (obj)(3:4));
+    if (strcmp (obj.activepositionproperty, "position"))
+      obj.position = obj.position .* [1, 1, scale];
+      off = 0.5 * (obj.position (3:4) - __actual_axis_position__ (obj)(3:4));
+    else
+      obj.outerposition = obj.outerposition .* [1, 1, scale];
+      off = 0.5 * (obj.outerposition (3:4) - __actual_axis_position__ (obj)(3:4));
+    endif
   else
     off = 0.0;
   endif
@@ -581,6 +592,7 @@
 %! shading ("interp")
 %! axis ("tight", "square")
 %! colorbar ()
+#%! axes('color','none','box','on','activepositionproperty','position')
 
 %!demo
 %! clf