/usr/share/plplot_octave/axis.m is in octave-plplot 5.13.0+dfsg-6ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | ## Copyright (C) 1996 John W. Eaton
##
## This file is part of Octave.
##
## Octave is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## Octave is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
## usage: ax = axis ()
## axis (ax | opt)
## axis (ax, opt)
##
## Sets the axis limits.
##
## With no arguments, turns "autoscaling" on, and returns the current axis
##
## "ax" can be a 2, 4 or 6 element row vector that sets the minimum and
## maximum lower and upper limits of the data that will be plotted:
## [xmin, xmax], [xmin, xmax, ymin, ymax], [xmin, xmax, ymin, ymax, zmin, zmax]
##
## "opt" is an option string, that:
##
## control the aspect ratio of the axes:
## "square" Force a square aspect ratio.
## "equal" Force x distance to equal y-distance.
## "normal" Restore the balance.
## "auto" Set the specified axes to have nice limits around the data.
## "manual" Fix the current axes limits.
## "tight" Fix axes to the limits of the data.
## "image" Equivalent to "tight" and "equal".
##
## affect the appearance of tic marks (note, if there are no tic marks
## for an axis, there can be no labels):
## "on" Turn tic marks and labels on for all axes.
## "off" Turn tic marks off for all axes.
## "tic[xy]" Turn tic marks on for all axes, or turn them on for
## the specified axes and off for the remainder.
## "label[xy] Turn tic labels on for all axes, or turn them on
## for the specified axes and off for the remainder.
## "nolabel" Turn tic labels off for all axes.
##
## affect the appearance of the x and y coordinate axis
## "axison" Turn on the x and y coordinate axis
## "axisoff" Turn off the x and y coordinate axis
##
## returns current axis state:
## [s1,s2,s3] = axis('state') returns current settings
## Author: jwe
## Modified: jc
function curr_axis = axis (ax, opt)
## the idea is that _pl.axis always has the current max/min axis, either
## as setup by the user, or automaticaly. It interacts with hold mode.
global __pl
global pl_automatic_replot
strm = __pl_init;
if (nargin == 0)
__pl.axis_st(strm) = 0;
__pl.aspect(strm) = 0;
curr_axis = __pl.axis(strm,:);
elseif (nargin == 1 && ischar (ax))
opt = ax; ax = [];
elseif (nargin == 1 && isvector (ax))
opt = "";
else
usage "axis"
endif
if (nargin != 0 && !isempty (ax))
len = length (ax);
if (len != 2 && len != 4 && len != 6)
error ("axis: expecting vector with 2, 4, or 6 elements.\n");
endif
__pl.axis_st(strm) = 1;
if (len > 1)
__pl.axis(strm, [1, 2]) = [ax(1), ax(2)];
endif
if (len > 3)
__pl.axis(strm, [3, 4]) = [ax(3), ax(4)];
endif
if (len > 5)
__pl.axis(strm, [5, 6]) = [ax(5), ax(6)];
endif
elseif (nargin != 0 && !isempty(opt))
switch(opt)
case "state" ## [s1, s2, s3] = axis('state') returns current settings
## S1 = 'auto' or 'manual'.
if (__pl.axis_st(strm) == 0 && __pl.margin(strm) == 1)
S1 = "auto";
elseif (__pl.axis_st(strm) == 1)
S1 = "manual";
elseif (__pl.axis_st(strm) == 0 && __pl.margin(strm) == 0)
S1 = "tight";
elseif (__pl.aspect(strm) == 1 &&__pl.axis_st(strm) == 0)
S1 = "image";
endif
## S2 = 'on' or 'off'.
S2 = "off";
if (__pl.xticks(strm,3) == 1 && __pl.yticks(strm,3) == 1)
S2 = "on";
endif
## S3 = 'xy' or 'ij'.
S3 = "xy";
curr_axis = [S1; S2; S3];
## aspect ratio
case "square"
__pl.aspect(strm) = 2;
case "equal"
__pl.aspect(strm) = 1;
case "normal"
__pl.axis_st(strm) = 0;
__pl.aspect(strm) = 0;
## the way axis limits are interpreted.
case "auto"
__pl.axis_st(strm) = 0;
__pl.margin(strm) = 1;
case "manual" ## fix the current axis
__pl.axis_st(strm) = 1;
case "tight"
__pl.axis_st(strm) = 0;
__pl.margin(strm) = 0;
case "image"
__pl.aspect(strm) = 1;
__pl.margin(strm) = 0;
## the appearance of tic marks
case "on" ## tic marks and tick labels on for all axes
__pl.xticks(strm,3) = 1;
__pl.xticks(strm,4) = 1;
__pl.yticks(strm,3) = 1;
__pl.yticks(strm,4) = 1;
case "off" ## tic marks off for all axes
__pl.xticks(strm,3) = 0;
__pl.yticks(strm,3) = 0;
case "ticxy" ## on for the specified axes and off for the remainder.
__pl.xticks(strm,3) = 1;
__pl.yticks(strm,3) = 1;
case "ticx"
__pl.xticks(strm,3) = 1;
__pl.yticks(strm,3) = 0;
case "ticy"
__pl.xticks(strm,3) = 0;
__pl.yticks(strm,3) = 1;
## the appearance of tic labels
case "labelxy" ## on for the specified axes and off for the remainder.
__pl.xticks(strm,4) = 1;
__pl.yticks(strm,4) = 1;
case "labelx"
__pl.xticks(strm,4) = 1;
__pl.yticks(strm,4) = 0;
case "labely"
__pl.xticks(strm,4) = 0;
__pl.yticks(strm,4) = 1;
case "nolabel" ## Turn tic labels off for all axes.
__pl.xticks(strm,4) = 0;
__pl.yticks(strm,4) = 0;
## the direction of increasing values on the axes
case "ij"
warning("axis: option 'ij' not supported.");
case "xy"
1; ## default
## the appearance of the xy axis
case "axison"
__pl.axisxy(strm) = 1;
case "axisoff"
__pl.axisxy(strm) = 0;
otherwise
error("axis: option '%s' not recognized.\n", tdeblank(opt));
endswitch
endif
if (exist("pl_automatic_replot"))
if (pl_automatic_replot)
__pl_plotit;
endif
endif
endfunction
|