comparison scripts/plot/util/linkaxes.m @ 18731:65f19ac3cd1b

linkaxes.m: Trim extra spaces at EOL. * linkaxes.m: Trim extra spaces at EOL.
author Rik <rik@octave.org>
date Mon, 05 May 2014 13:14:17 -0700
parents d1750be79dee
children 3136e3f8e631
comparison
equal deleted inserted replaced
18729:d1750be79dee 18731:65f19ac3cd1b
1 ## Copyright (C) 2014 Willem Atsma 1 ## Copyright (C) 2014 Willem Atsma
2 ## 2 ##
3 ## This file is part of Octave. 3 ## This file is part of Octave.
4 ## 4 ##
5 ## Octave is free software; you can redistribute it and/or modify it 5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by 6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at 7 ## the Free Software Foundation; either version 3 of the License, or (at
14 ## 14 ##
15 ## You should have received a copy of the GNU General Public License 15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see 16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>. 17 ## <http://www.gnu.org/licenses/>.
18 18
19 ## -*- texinfo -*- 19 ## -*- texinfo -*-
20 ## @deftypefn {Function File} linkaxes (@var{hax}) 20 ## @deftypefn {Function File} linkaxes (@var{hax})
21 ## @deftypefnx {Function File} linkaxes (@var{hax}, @var{optstr}) 21 ## @deftypefnx {Function File} linkaxes (@var{hax}, @var{optstr})
22 ## Link the axis limits of 2-D plots such that a change in one is 22 ## Link the axis limits of 2-D plots such that a change in one is
23 ## propagated to the others. 23 ## propagated to the others.
24 ## 24 ##
25 ## The axes handles to be linked are passed as the first argument @var{hax}. 25 ## The axes handles to be linked are passed as the first argument @var{hax}.
26 ## 26 ##
27 ## The optional second argument is a string which defines which axis limits 27 ## The optional second argument is a string which defines which axis limits
70 for i = 1:length (hax) 70 for i = 1:length (hax)
71 if (isprop (hax(i), "linkaxes_data")) 71 if (isprop (hax(i), "linkaxes_data"))
72 hld = get (hax(i), "linkaxes_data"); 72 hld = get (hax(i), "linkaxes_data");
73 try 73 try
74 rmappdata (hld, "linkprop_data"); 74 rmappdata (hld, "linkprop_data");
75 end_try_catch 75 end_try_catch
76 else 76 else
77 addproperty ("linkaxes_data", hax(i), "any"); 77 addproperty ("linkaxes_data", hax(i), "any");
78 endif 78 endif
79 endfor 79 endfor
80 80
81 switch (optstr) 81 switch (optstr)
82 case "x" 82 case "x"
83 hlink = linkprop (hax, "xlim"); 83 hlink = linkprop (hax, "xlim");
84 case "y" 84 case "y"
85 hlink = linkprop (hax, "ylim"); 85 hlink = linkprop (hax, "ylim");
89 ## do nothing - link already deleted 89 ## do nothing - link already deleted
90 hlink = []; 90 hlink = [];
91 otherwise 91 otherwise
92 error ("linkaxes: unrecognized OPTSTR '%s'", optstr); 92 error ("linkaxes: unrecognized OPTSTR '%s'", optstr);
93 endswitch 93 endswitch
94 94
95 if (! isempty (hlink)) 95 if (! isempty (hlink))
96 setappdata (hax(1), "linkprop_data", hlink); 96 setappdata (hax(1), "linkprop_data", hlink);
97 set (hax, "linkaxes_data", hax(1)); 97 set (hax, "linkaxes_data", hax(1));
98 else 98 else
99 set (hax, "linkaxes_data", []); 99 set (hax, "linkaxes_data", []);
100 endif 100 endif
101 101
102 endfunction 102 endfunction
103 103
104 104