Mercurial > octave
comparison scripts/plot/axis.m @ 11587:c792872f8942
all script files: untabify and strip trailing whitespace
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 Jan 2011 17:35:29 -0500 |
parents | b124b83e5626 |
children | b0084095098e |
comparison
equal
deleted
inserted
replaced
11586:12df7854fa7c | 11587:c792872f8942 |
---|---|
30 ## The argument @var{limits} should be a 2-, 4-, or 6-element vector. The | 30 ## The argument @var{limits} should be a 2-, 4-, or 6-element vector. The |
31 ## first and second elements specify the lower and upper limits for the | 31 ## first and second elements specify the lower and upper limits for the |
32 ## x-axis. The third and fourth specify the limits for the y-axis, and the | 32 ## x-axis. The third and fourth specify the limits for the y-axis, and the |
33 ## fifth and sixth specify the limits for the z-axis. | 33 ## fifth and sixth specify the limits for the z-axis. |
34 ## | 34 ## |
35 ## Without any arguments, @code{axis} turns autoscaling on. | 35 ## Without any arguments, @code{axis} turns autoscaling on. |
36 ## | 36 ## |
37 ## With one output argument, @code{x = axis} returns the current axes. | 37 ## With one output argument, @code{x = axis} returns the current axes. |
38 ## | 38 ## |
39 ## The vector argument specifying limits is optional, and additional | 39 ## The vector argument specifying limits is optional, and additional |
40 ## string arguments may be used to specify various axis properties. For | 40 ## string arguments may be used to specify various axis properties. For |
71 ## | 71 ## |
72 ## @noindent | 72 ## @noindent |
73 ## The following options control the way axis limits are interpreted. | 73 ## The following options control the way axis limits are interpreted. |
74 ## | 74 ## |
75 ## @table @asis | 75 ## @table @asis |
76 ## @item "auto" | 76 ## @item "auto" |
77 ## Set the specified axes to have nice limits around the data | 77 ## Set the specified axes to have nice limits around the data |
78 ## or all if no axes are specified. | 78 ## or all if no axes are specified. |
79 ## | 79 ## |
80 ## @item "manual" | 80 ## @item "manual" |
81 ## Fix the current axes limits. | 81 ## Fix the current axes limits. |
82 ## | 82 ## |
83 ## @item "tight" | 83 ## @item "tight" |
84 ## Fix axes to the limits of the data. | 84 ## Fix axes to the limits of the data. |
85 ## @end table | 85 ## @end table |
90 ## | 90 ## |
91 ## @noindent | 91 ## @noindent |
92 ## The following options affect the appearance of tic marks. | 92 ## The following options affect the appearance of tic marks. |
93 ## | 93 ## |
94 ## @table @asis | 94 ## @table @asis |
95 ## @item "on" | 95 ## @item "on" |
96 ## Turn tic marks and labels on for all axes. | 96 ## Turn tic marks and labels on for all axes. |
97 ## | 97 ## |
98 ## @item "off" | 98 ## @item "off" |
99 ## Turn tic marks off for all axes. | 99 ## Turn tic marks off for all axes. |
100 ## | 100 ## |
101 ## @item "tic[xyz]" | 101 ## @item "tic[xyz]" |
102 ## Turn tic marks on for all axes, or turn them on for the | 102 ## Turn tic marks on for all axes, or turn them on for the |
103 ## specified axes and off for the remainder. | 103 ## specified axes and off for the remainder. |
104 ## | 104 ## |
105 ## @item "label[xyz]" | 105 ## @item "label[xyz]" |
106 ## Turn tic labels on for all axes, or turn them on for the | 106 ## Turn tic labels on for all axes, or turn them on for the |
107 ## specified axes and off for the remainder. | 107 ## specified axes and off for the remainder. |
108 ## | 108 ## |
109 ## @item "nolabel" | 109 ## @item "nolabel" |
110 ## Turn tic labels off for all axes. | 110 ## Turn tic labels off for all axes. |
111 ## @end table | 111 ## @end table |
117 ## | 117 ## |
118 ## @table @asis | 118 ## @table @asis |
119 ## @item "ij" | 119 ## @item "ij" |
120 ## Reverse y-axis, so lower values are nearer the top. | 120 ## Reverse y-axis, so lower values are nearer the top. |
121 ## | 121 ## |
122 ## @item "xy" | 122 ## @item "xy" |
123 ## Restore y-axis, so higher values are nearer the top. | 123 ## Restore y-axis, so higher values are nearer the top. |
124 ## @end table | 124 ## @end table |
125 ## | 125 ## |
126 ## If an axes handle is passed as the first argument, then operate on | 126 ## If an axes handle is passed as the first argument, then operate on |
127 ## this axes rather than the current axes. | 127 ## this axes rather than the current axes. |
128 ## @end deftypefn | 128 ## @end deftypefn |
129 | 129 |
130 ## Author: jwe | 130 ## Author: jwe |
182 set (ca, "plotboxaspectratio", [1, 1, 1]); | 182 set (ca, "plotboxaspectratio", [1, 1, 1]); |
183 elseif (strcmp (ax, "equal")) | 183 elseif (strcmp (ax, "equal")) |
184 if (strcmp (get (get (ca, "parent"), "__graphics_toolkit__"), "gnuplot")) | 184 if (strcmp (get (get (ca, "parent"), "__graphics_toolkit__"), "gnuplot")) |
185 ## FIXME - gnuplot applies the aspect ratio activepostionproperty. | 185 ## FIXME - gnuplot applies the aspect ratio activepostionproperty. |
186 set (ca, "activepositionproperty", "position"); | 186 set (ca, "activepositionproperty", "position"); |
187 ## The following line is a trick used to trigger the recalculation of | 187 ## The following line is a trick used to trigger the recalculation of |
188 ## aspect related magnitudes even if the aspect ratio is the same | 188 ## aspect related magnitudes even if the aspect ratio is the same |
189 ## (useful with the x11 gnuplot terminal after a window resize) | 189 ## (useful with the x11 gnuplot terminal after a window resize) |
190 set (ca, "dataaspectratiomode", "auto"); | 190 set (ca, "dataaspectratiomode", "auto"); |
191 endif | 191 endif |
192 set (ca, "dataaspectratio", [1, 1, 1]) | 192 set (ca, "dataaspectratio", [1, 1, 1]) |
323 data(data<=0) = NaN; | 323 data(data<=0) = NaN; |
324 end | 324 end |
325 if (iscell (data)) | 325 if (iscell (data)) |
326 data = data (find (! cellfun (@isempty, data))); | 326 data = data (find (! cellfun (@isempty, data))); |
327 if (! isempty (data)) | 327 if (! isempty (data)) |
328 lims_min = min (cellfun (@min, cellfun (@min, data, 'uniformoutput', false)(:))); | 328 lims_min = min (cellfun (@min, cellfun (@min, data, 'uniformoutput', false)(:))); |
329 lims_max = max (cellfun (@max, cellfun (@max, data, 'uniformoutput', false)(:))); | 329 lims_max = max (cellfun (@max, cellfun (@max, data, 'uniformoutput', false)(:))); |
330 lims = [lims_min, lims_max]; | 330 lims = [lims_min, lims_max]; |
331 else | 331 else |
332 lims = [0, 1]; | 332 lims = [0, 1]; |
333 endif | 333 endif |
334 else | 334 else |
335 lims = [min(data(:)), max(data(:))]; | 335 lims = [min(data(:)), max(data(:))]; |
363 %! | 363 %! |
364 %! subplot(223); | 364 %! subplot(223); |
365 %! plot(t, x); | 365 %! plot(t, x); |
366 %! title("equal plot"); | 366 %! title("equal plot"); |
367 %! axis("equal"); | 367 %! axis("equal"); |
368 %! | 368 %! |
369 %! subplot(224); | 369 %! subplot(224); |
370 %! plot(t, x); | 370 %! plot(t, x); |
371 %! title("normal plot again"); | 371 %! title("normal plot again"); |
372 %! axis("normal"); | 372 %! axis("normal"); |
373 | 373 |