View Raw SPL
/*****************************************************************************
* *
* SEMILOGX.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_SEMILOGX
SEMILOGX
Purpose: Sets or unsets log X scales.
Syntax: SEMILOGX(win1, win2, ..., winN, mode)
win - Zero or more optional windows. Defaults to the
current window.
mode - Optional, an integer. The SEMILOGX mode,
0: off
1: on with 10^N exponential labels (default)
2: on with 10.0 linear labels
Returns: Nothing, the X axis is set or unset to log X scales and the Y
axis is set to linear scales.
Example:
W1: grand(100, 1);semilogx
The series in W1 is displayed with X log and Y linear scales.
Example:
W1: grand(100, 1)
W2: integ(W1)
W3: integ(W2)
W4: integ(W3)
semilogx(W1..W4)
The series in W1 through W4 are displayed with X log and
Y linear scales.
Example:
semilogx(W1..W4, 0)
Resets the X and Y scales to linear for the series in W1
through W4.
Remarks:
SEMILOGX uses SETXLOG and SETYLOG to set the log scales. The log
tic values are displayed in 10^N form.
See Also:
Loglog
Semilogy
Setxlog
Setylog
#endif
/* X log, Y linear scales */
semilogx(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))
{
semilogx_plot(w, mode);
}
}
}
else
{
/* current window */
semilogx_plot(w0, mode);
}
}
semilogx_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);
setxlog(w, mode, 0, exp);
setylog(w, 0);
if (isstripchart(w))
{
if (getfocus(w) == 0)
{
/* root - set all traces */
setstripchart();
autoscale();
}
}
plotmode(w, pm, 0);
if (iswindow(home))
{
gotowindow(home);
}
}
}