Functions | |
newplot () | |
if (i==1) set(ax | |
endif | if (isempty(llc)) lc |
endif | if (isempty(mmc)) mc |
endif | if (dofill) fc |
endif | if (have_z) h_stems |
set (h_baseline,"handlevisibility","off") | |
set (h_baseline,"xliminclude","off") | |
addlistener (ax,"xlim",@update_xlim) | |
addlistener (h_baseline,"ydata",@update_baseline) | |
addlistener (h_baseline,"visible",@update_baseline) | |
endif endif | addproperty ("showbaseline", hg,"radio","{on}|off") |
addproperty ("basevalue", hg,"data", 0) | |
addproperty ("baseline", hg,"data", h_baseline) | |
if (!have_z) addlistener(hg | |
addlistener (hg,"basevalue",@move_baseline) | |
endif | addproperty ("color", hg,"linecolor", lc) |
addproperty ("linewidth", hg,"linelinewidth", 0.5) | |
addproperty ("linestyle", hg,"linelinestyle", ls) | |
addproperty ("marker", hg,"linemarker", ms) | |
addproperty ("markerfacecolor", hg,"linemarkerfacecolor", fc) | |
addproperty ("markersize", hg,"linemarkersize", 6) | |
addlistener (hg,"color",@update_props) | |
addlistener (hg,"linewidth",@update_props) | |
addlistener (hg,"linestyle",@update_props) | |
addlistener (hg,"marker",@update_props) | |
addlistener (hg,"markerfacecolor",@update_props) | |
addlistener (hg,"markersize",@update_props) | |
addproperty ("xdata", hg,"data", x(:, i)) | |
addproperty ("ydata", hg,"data", y(:, i)) | |
z (:, i)) | |
else | addproperty ("zdata", hg,"data",[]) |
endif | addlistener (hg,"xdata",@update_data) |
addlistener (hg,"ydata",@update_data) | |
addlistener (hg,"zdata",@update_data) | |
if (!isempty(args)) set(hg | |
endif | get (hg,"parent")) |
endif endfor unwind_protect_cleanup | set (ax,"nextplot", hold_state) |
axes (oldax) | |
while (i< length(varargin)) if(ischar(varargin | |
&& | strcmpi ("fill", varargin{i})||strcmpi("filled" |
varargin (i:i+1) | |
if (nargin==2) if(have_z) z | |
if (isvector(y)) x | |
elseif (ismatrix(y)) x = 1:rows (y) | |
else | error ("stem: Y must be a matrix") |
endif endif | elseif (nargin==3) if(ischar(varargin |
if (strcmpi("fill", varargin{2})||strcmpi("filled", varargin{2})) dofill | |
elseif (isfield(cur_props(i),"linestyle")) ls | |
elseif (isfield(cur_props(i),"marker")&&!strcmpi(cur_props(i).marker,"none")) ms | |
endfunction function | update_xlim (h, d) kids |
if (strcmp(obj.type,"hggroup")&&isfield(obj,"baseline")) if(any(get(obj.baseline | |
endif endif endfor endfunction function | update_baseline (h, d) visible |
if (strcmp(obj.type,"hggroup")&&isfield(obj,"baseline")&&obj.baseline==h) if(!strcmpi(get(kids(i) | |
visible | set (kids(i),"showbaseline", visible) |
endif | if (!strcmpi(get(kids(i),"basevalue"), visible)) set(kids(i) |
endif endif endfor endfunction function | show_baseline (h, d) set(get(h |
endif endif endfor endfunction function | get (h,"showbaseline")) |
endfunction function | move_baseline (h, d) b0 |
if (get(bl,"ydata")!=[b0, b0]) set(bl | |
NaN(1, ny)]( | set (kids(2),"ydata", yt) |
endfunction function | update_props (h, d) kids |
set (kids(2),"color", get(h,"color"),"linewidth", get(h,"linewidth"),"linestyle", get(h,"linestyle")) | |
set (kids(1),"color", get(h,"color"),"marker", get(h,"marker"),"markerfacecolor", get(h,"markerfacecolor"),"markersize", get(h,"markersize")) | |
endfunction function | update_data (h, d) x |
Variables | |
function | h |
else | caller = "stem" |
endif [ax, varargin, nargin] = __plt_get_axis_arg__ (caller, varargin{:}) | |
oldax | |
unwind_protect | axes (ax) |
hold_state = get (ax, "nextplot") | |
nx = rows (x) | |
for | i |
xt = [xt | |
NaN(1, nx)]( | yt = y(:)' |
NaN(1, nx)]( | zt = z(:)' |
NaN(1, nx)](endif | hg = hggroup () |
args = __add_datasource__ (caller, hg, {"x", "y", "z"}, varargin{:}) | |
nextplot | |
add | |
else | lc = llc |
else | mc = mmc |
else | fc = "none" |
h_baseline = [] | |
else | h_stems |
showbaseline | |
show_baseline | |
data | |
endif | parent |
end_unwind_protect endfunction | function [x, y, z, dofill, lc, ls, mc, ms, newargs] |
newargs = {} | |
nargin = nargin - 2 | |
endif | endwhile [lc, ls, mc, ms] = set_default_values () |
dofill = 0 | |
fill_2 = 0 | |
linespec_2 = 0 | |
z = [] | |
x = 1:rows (z) | |
y = 1:columns (z) | |
else [lc, ls, mc, ms] = stem_line_spec (caller, varargin{2}) | |
cur_props = __pltopt__ ("stem", str, false) | |
ls = "-" | |
ms = "o" | |
xlim = get (h, "xlim") | |
xdata | |
ydata = get (h, "ydata")(1) | |
kids = get (get (h, "parent"), "children") | |
endif | basevalue |
endif endif endfor endfunction function | baseline |
endif endif endfor endfunction function | visible |
bl = get (h, "baseline") | |
ny = length (yt) |
addlistener | ( | hg | , | |
"zdata" | , | |||
@ | update_data | |||
) |
addlistener | ( | hg | , | |
"ydata" | , | |||
@ | update_data | |||
) |
addlistener | ( | hg | , | |
"markersize" | , | |||
@ | update_props | |||
) |
addlistener | ( | hg | , | |
"markerfacecolor" | , | |||
@ | update_props | |||
) |
addlistener | ( | hg | , | |
"marker" | , | |||
@ | update_props | |||
) |
addlistener | ( | hg | , | |
"linestyle" | , | |||
@ | update_props | |||
) |
addlistener | ( | hg | , | |
"linewidth" | , | |||
@ | update_props | |||
) |
addlistener | ( | hg | , | |
"color" | , | |||
@ | update_props | |||
) |
addlistener | ( | hg | , | |
"basevalue" | , | |||
@ | move_baseline | |||
) |
addlistener | ( | h_baseline | , | |
"visible" | , | |||
@ | update_baseline | |||
) |
addlistener | ( | h_baseline | , | |
"ydata" | , | |||
@ | update_baseline | |||
) |
addlistener | ( | ax | , | |
"xlim" | , | |||
@ | update_xlim | |||
) |
addproperty | ( | "ydata" | , | |
hg | , | |||
"data" | , | |||
y(:, i) | ||||
) |
addproperty | ( | "xdata" | , | |
hg | , | |||
"data" | , | |||
x(:, i) | ||||
) |
addproperty | ( | "markersize" | , | |
hg | , | |||
"linemarkersize" | , | |||
6 | ||||
) |
addproperty | ( | "linestyle" | , | |
hg | , | |||
"linelinestyle" | , | |||
ls | ||||
) |
addproperty | ( | "linewidth" | , | |
hg | , | |||
"linelinewidth" | , | |||
0. | 5 | |||
) |
addproperty | ( | "baseline" | , | |
hg | , | |||
"data" | , | |||
h_baseline | ||||
) |
addproperty | ( | "basevalue" | , | |
hg | , | |||
"data" | , | |||
0 | ||||
) |
elseif | ( | isfield(cur_props(i),"linestyle") | ) |
elseif | ( | ismatrix(y) | ) | = 1:rows (y) |
else error | ( | "stem: Y must be a matrix" | ) |
endif endif endfor endfunction function get | ( | h | , | |
"showbaseline" | ||||
) |
endif if | ( | ! | strcmpiget(kids(i),"basevalue"), visible | ) |
if | ( | strcmpi("fill", varargin{2})||strcmpi("filled", varargin{2}) | ) |
if | ( | isvector(y) | ) |
if | ( | nargin | = =2 |
) |
if | ( | ! | isemptyargs | ) |
if | ( | ! | have_z | ) |
endif if | ( | have_z | ) |
endif if | ( | isempty(mmc) | ) |
endif if | ( | isempty(llc) | ) |
if | ( | i | = = 1 |
) |
endfunction function move_baseline | ( | h | , | |
d | ||||
) |
newplot | ( | ) |
set | ( | kids(1) | , | |
"color" | , | |||
get(h,"color") | , | |||
"marker" | , | |||
get(h,"marker") | , | |||
"markerfacecolor" | , | |||
get(h,"markerfacecolor") | , | |||
"markersize" | , | |||
get(h,"markersize") | ||||
) |
set | ( | kids(2) | , | |
"color" | , | |||
get(h,"color") | , | |||
"linewidth" | , | |||
get(h,"linewidth") | , | |||
"linestyle" | , | |||
get(h,"linestyle") | ||||
) |
endif endfor unwind_protect_cleanup set | ( | ax | , | |
"nextplot" | , | |||
hold_state | ||||
) |
set | ( | h_baseline | , | |
"xliminclude" | , | |||
"off" | ||||
) |
set | ( | h_baseline | , | |
"handlevisibility" | , | |||
"off" | ||||
) |
endif endif endfor endfunction function show_baseline | ( | h | , | |
d | ||||
) |
&& strcmpi | ( | "fill" | ) |
endif endif endfor endfunction function update_baseline | ( | h | , | |
d | ||||
) |
endfunction function update_data | ( | h | , | |
d | ||||
) |
endfunction function update_props | ( | h | , | |
d | ||||
) |
endfunction function update_xlim | ( | h | , | |
d | ||||
) |
varargin | ( | i:i+ | 1 | ) |
while | ( | ) | [new] |
z | ( | : | , | |
i | ||||
) |
unwind_protect axes(ax) |
bl = get (h, "baseline") |
cur_props = __pltopt__ ("stem", str, false) |
dofill = 0 |
endif endif else if (have_z) error ("stem3 endif[lc, ls, mc, ms] = __plt_get_axis_arg__ (caller, varargin{:}) |
fill_2 = 0 |
h_baseline = [] |
hold_state = get (ax, "nextplot") |
lc = llc |
linespec_2 = 0 |
ls = "-" |
mc = mmc |
ms = "o" |
newargs = {} |
nx = rows (x) |
show_baseline |
x = 1:rows (z) |
xlim = get (h, "xlim") |
y = 1:columns (z) |
ydata = get (h, "ydata")(1) |
yt = y(:)' |
z = [] |
zt = z(:)' |