comparison scripts/plot/plotyy.m @ 10549:95c3e38098bf

Untabify .m scripts
author Rik <code@nomad.inbox5.com>
date Fri, 23 Apr 2010 11:28:50 -0700
parents 7147078550fe
children be55736a0783
comparison
equal deleted inserted replaced
10548:479536c5bb10 10549:95c3e38098bf
63 obj2 = get (varargin{1}(2)); 63 obj2 = get (varargin{1}(2));
64 if (strcmp (obj1.type, "axes") || strcmp (obj2.type, "axes")) 64 if (strcmp (obj1.type, "axes") || strcmp (obj2.type, "axes"))
65 ax = [obj1, obj2]; 65 ax = [obj1, obj2];
66 varargin(1) = []; 66 varargin(1) = [];
67 if (isempty (varargin)) 67 if (isempty (varargin))
68 varargin = {}; 68 varargin = {};
69 endif 69 endif
70 else 70 else
71 error ("plotyy: expecting first argument to be axes handle"); 71 error ("plotyy: expecting first argument to be axes handle");
72 endif 72 endif
73 else 73 else
168 set (ax(2), "color", "none"); 168 set (ax(2), "color", "none");
169 169
170 ## Add invisible text objects that when destroyed, 170 ## Add invisible text objects that when destroyed,
171 ## also remove the other axis 171 ## also remove the other axis
172 t1 = text (0, 0, "", "parent", ax(1), "tag", "plotyy", 172 t1 = text (0, 0, "", "parent", ax(1), "tag", "plotyy",
173 "handlevisibility", "off", "visible", "off", 173 "handlevisibility", "off", "visible", "off",
174 "xliminclude", "off", "yliminclude", "off"); 174 "xliminclude", "off", "yliminclude", "off");
175 t2 = text (0, 0, "", "parent", ax(2), "tag", "plotyy", 175 t2 = text (0, 0, "", "parent", ax(2), "tag", "plotyy",
176 "handlevisibility", "off", "visible", "off", 176 "handlevisibility", "off", "visible", "off",
177 "xliminclude", "off", "yliminclude", "off"); 177 "xliminclude", "off", "yliminclude", "off");
178 178
179 set (t1, "deletefcn", {@deleteplotyy, ax(2), t2}); 179 set (t1, "deletefcn", {@deleteplotyy, ax(2), t2});
180 set (t2, "deletefcn", {@deleteplotyy, ax(1), t1}); 180 set (t2, "deletefcn", {@deleteplotyy, ax(1), t1});
181 181
182 addlistener (ax(1), "position", {@update_position, ax(2)}); 182 addlistener (ax(1), "position", {@update_position, ax(2)});
244 oldposition = get (ax2, "position"); 244 oldposition = get (ax2, "position");
245 oldview = get (ax2, "view"); 245 oldview = get (ax2, "view");
246 oldplotboxaspectratio = get (ax2, "plotboxaspectratio"); 246 oldplotboxaspectratio = get (ax2, "plotboxaspectratio");
247 oldplotboxaspectratiomode = get (ax2, "plotboxaspectratiomode"); 247 oldplotboxaspectratiomode = get (ax2, "plotboxaspectratiomode");
248 if (! (isequal (position, oldposition) && isequal (view, oldview))) 248 if (! (isequal (position, oldposition) && isequal (view, oldview)))
249 set (ax2, "position", position, "view", view) 249 set (ax2, "position", position, "view", view)
250 endif 250 endif
251 if (! (isequal (plotboxaspectratio, oldplotboxaspectratio) 251 if (! (isequal (plotboxaspectratio, oldplotboxaspectratio)
252 && isequal (plotboxaspectratiomode, oldplotboxaspectratiomode))) 252 && isequal (plotboxaspectratiomode, oldplotboxaspectratiomode)))
253 set (ax2, "plotboxaspectratio", plotboxaspectratio); 253 set (ax2, "plotboxaspectratio", plotboxaspectratio);
254 set (ax2, "plotboxaspectratiomode", plotboxaspectratiomode); 254 set (ax2, "plotboxaspectratiomode", plotboxaspectratiomode);
255 endif 255 endif
256 unwind_protect_cleanup 256 unwind_protect_cleanup
257 recursion = false; 257 recursion = false;
258 end_unwind_protect 258 end_unwind_protect
259 endif 259 endif