View Raw SPL
/*****************************************************************************
* *
* WINFLIPX.SPL Copyright (C) 2015 DSP Development Corporation *
* All Rights Reserved *
* *
* Author: Randy Race *
* *
* Synopsis: Flips X scale orientation of an window *
* *
* Revisions: 25 Nov 2015 RRR Creation *
* *
*****************************************************************************/
#if @HELP_WINFLIPX
WINFLIPX
Purpose: Flips the X scales of a window
Syntax: WINFLIPX(win, lr)
win - Optional. A window, defaults to current window
lr - Optional. An integer, the scales mode:
0: left to right
1: right to left (default)
Returns: Nothing, the X scales are flipped.
Example:
W1: integ(gnorm(1000, 1));
W2: w1;winflipx
W1 and W2 contain the same series. The X scales go left
to right from the smallest to the largest value in W1 and
the X scales go left to right from the largest to the
smallest value in W2.
Example:
W1: Density(spline2(rand(5), 20));
W2: w1;winflipx
W1 and W2 contain the same image. The X scales go left to
right from the smallest to the largest value in W1 and the
X scales go left to right from the largest to the smallest
value in W2.
Remarks:
WINFLIPX changes the direction of the X scales of a Window,
the actual data remains unchanged.
See Also:
Sety
Setyauto
Winflipy
#endif
/* flip x scales on series or image */
winflipx(argv)
{
local w, mode;
w = {};
mode = 1;
loop (j = 1..argc)
{
arg = getargv(j);
if (iswindow(getargv(j)))
{
w = refwindow(getargv(j));
}
else if (isscalar(getargv(j)))
{
mode = getargv(j);
}
}
if (isempty(w))
{
w = refwindow(w0);
}
switch (mode)
{
case 0:
default:
setxauto(w, -1, -1);
autoscale(w);
break;
case 1:
setxauto(w, -1, -1);
autoscale(w);
setxauto(w, getxr(w), getxl(w));
autoscale(w);
break;
}
}