Mercurial > octave
comparison scripts/plot/appearance/axis.m @ 21808:a4c744194bbb
Add equal data aspect ratio to gnuplot graphics toolkit 3D plots (bug #47974).
* axis.m: Clarify meaning of 'square' and 'equal' in documentation. Remove
gnuplot-specific FIXME.
* __gnuplot_draw_axes__.m: Remove line of cruft for sz_str. If the plot is 3D
and data aspect ratio is equal in at least x-y dimensions, then set view
equal.
author | Daniel J Sebald <daniel.sebald@ieee.org> |
---|---|
date | Thu, 02 Jun 2016 11:06:56 -0500 |
parents | 89fa0694aa2e |
children | 9121d6584f6a |
comparison
equal
deleted
inserted
replaced
21807:1955af16b42e | 21808:a4c744194bbb |
---|---|
59 ## @noindent | 59 ## @noindent |
60 ## The following options control the aspect ratio of the axes. | 60 ## The following options control the aspect ratio of the axes. |
61 ## | 61 ## |
62 ## @table @asis | 62 ## @table @asis |
63 ## @item @qcode{"square"} | 63 ## @item @qcode{"square"} |
64 ## Force a square aspect ratio. | 64 ## Force a square axis aspect ratio. |
65 ## | 65 ## |
66 ## @item @qcode{"equal"} | 66 ## @item @qcode{"equal"} |
67 ## Force x distance to equal y-distance. | 67 ## Force x-axis unit distance to equal y-axis (and z-axis) unit distance. |
68 ## | 68 ## |
69 ## @item @qcode{"normal"} | 69 ## @item @qcode{"normal"} |
70 ## Restore default aspect ratio. | 70 ## Restore default aspect ratio. |
71 ## @end table | 71 ## @end table |
72 ## | 72 ## |
189 __do_tight_option__ (ca); | 189 __do_tight_option__ (ca); |
190 elseif (strcmpi (ax, "square")) | 190 elseif (strcmpi (ax, "square")) |
191 set (ca, "dataaspectratiomode", "auto", | 191 set (ca, "dataaspectratiomode", "auto", |
192 "plotboxaspectratio", [1, 1, 1]); | 192 "plotboxaspectratio", [1, 1, 1]); |
193 elseif (strcmp (ax, "equal")) | 193 elseif (strcmp (ax, "equal")) |
194 if (strcmp (get (ancestor (ca, "figure"), "__graphics_toolkit__"), "gnuplot")) | |
195 ## FIXME: gnuplot applies the aspect ratio activepostionproperty. | |
196 set (ca, "activepositionproperty", "position"); | |
197 ## The following line is a trick used to trigger the recalculation of | |
198 ## aspect related magnitudes even if the aspect ratio is the same | |
199 ## (useful with the x11 gnuplot terminal after a window resize) | |
200 set (ca, "dataaspectratiomode", "auto"); | |
201 endif | |
202 set (ca, "dataaspectratio", [1, 1, 1], "plotboxaspectratio", [5 4 4]); | 194 set (ca, "dataaspectratio", [1, 1, 1], "plotboxaspectratio", [5 4 4]); |
203 | 195 |
204 elseif (strcmpi (ax, "normal")) | 196 elseif (strcmpi (ax, "normal")) |
205 ## Set plotboxaspectratio to something obtuse so that switching | 197 ## Set plotboxaspectratio to something obtuse so that switching |
206 ## back to "auto" will force a re-calculation. | 198 ## back to "auto" will force a re-calculation. |