View Raw SPL
/*****************************************************************************
* *
* SEMILOGY.SPL Copyright (C) 2015 DSP Development Corporation *
* All Rights Reserved *
* *
* Author: Randy Race *
* *
* Synopsis: Sets or unsets log X scales *
* *
* Revisions: 12 Mar 2015 RRR Creation *
* *
*****************************************************************************/
#if @HELP_SEMILOGY
SEMILOGY
Purpose: Sets or unsets log X scales.
Syntax: SEMILOGY(win1, win2, ..., winN, mode)
win - Zero or more optional windows. Defaults to the
current window.
mode - Optional, an integer. The SEMILOGY mode,
0: off
1: on (default)
2: on with 10.0 linear labels
Returns: Nothing, the Y axis is set or unset to log Y scales and the X
axis is set to linear scales.
Example:
W1: grand(100, 1);semilogy
The series in W1 is displayed with Y log and X linear scales.
Example:
W1: grand(100, 1)
W2: integ(W1)
W3: integ(W2)
W4: integ(W3)
semilogy(W1..W4)
The series in W1 through W4 are displayed with Y log and
X linear scales.
Example:
semilogy(W1..W4, 0)
Resets the X and Y scales to linear for the series in W1
through W4.
Remarks:
SEMILOGY uses SETXLOG and SETYLOG to set the log scales. The log
tic values are displayed in 10^N form.
See Also:
Loglog
Semilogx
Setxlog
Setylog
#endif
/* Y log, X linear scales */
semilogy(argv)
{
local k, w, mode = 1, wcnt = 0;
/* first get mode, if any */
loop (k = 1..argc)
{
w = getargv(k);
if (isscalar(w))
{
mode = w;
}
else if (iswindow(w))
{
wcnt++;
}
}
/* set axes */
if (wcnt > 0)
{
loop (k = 1..argc)
{
w = getargv(k);
if (iswindow(w))
{
semilogy_plot(w, mode);
}
}
}
else
{
/* current window */
semilogy_plot(w0, mode);
}
}
semilogy_plot(w, mode)
{
local pm, exp, home = {};
if (iswindow(w))
{
if (isstripchart(w) && not(getwnum(w0) == getwnum(w)))
{
home = refwindow(w0);
gotowindow(w);
}
exp = (mode > 1) ? 0 : 1;
pm = plotmode(w, 0);
setylog(w, mode, 0, exp);
setxlog(w, 0);
if (isstripchart(w))
{
if (getfocus(w) == 0)
{
/* root - set all traces */
setstripchart();
autoscale();
}
}
plotmode(w, pm, 0);
if (iswindow(home))
{
gotowindow(home);
}
}
}