Plot coordinate pairs/REXX: Difference between revisions

added the help documentation for the $PLOT.REX (REXX) program
(added the REXX $PLOT.REX program.)
(added the help documentation for the $PLOT.REX (REXX) program)
Line 1:
This is a REXX program that satisfies the Rosetta Code task ''Plot coordinate pairs''.
 
This is a general purpose REXX program that supports a variety of options and data formats and produces output in text format.
 
See the   HELP   documentation below.
=={{header|REXX}}==
 
==REXX program==
<lang rexx>/**/trace o;parse arg !;if !all(arg()) then exit;if !cms then address '';signal on halt;signal on novalue;signal on syntax
 
Line 446 ⟶ 452:
simple: return translate(arg(1),'.||--%<>AV'copies('+',25),"·│║─═☼◄►↑↓┤┐└┴┬├┼┘┌╔╗╚╝╟╢╞╡╫╪╤╧╥╨╠╣")
syntax: !sigl=sigl; call er 13,!fid(2) !fid(3) !sigl !cal() condition('D') sourceline(!sigl)</lang>
 
==REXX program help==
<pre>
 
┌───────┐ ┌┐ ┌──────────┐ ┌────────────┐
┌┘ ┌───┐ └┐ ││ ┌┘ ┌──────┐ └┐ │┌────┐┌────┐│
│ │ │ │ ││ │ │ │ │ └┘ ││ └┘
│ │ │ │ ││ │ │ │ │ ││
│ │ │ │ ││ │ │ │ │ ││
│ └───┘ ┌┘ ││ │ │ │ │ ││
│┌───────┘ ││ │ │ │ │ ││
││ ││ │ │ │ │ ││
││ ││ │ │ │ │ ││
││ ││ ┌┐ │ │ │ │ ││
││ ││ ││ │ │ │ │ ││
││ │└───────┘│ └┐ └──────┘ ┌┘ ││
││ │┌────────┘ └────┐┌────┘ ││
───┘└──────────────────┘└─────────────────────────┘└────────────────────┘└──────
 
 
The $PLOT command/subroutine is used to display a plot of specified pairs of
numbers (X,Y coordinates), or plot a list of numbers (singularly), with either
the X or Y cordinates being implied, the default is 0 ───► n─1, the origin and
increment can be overridden.
 
╔══════════════════════════════════════════════════════════════════════════════╗
║ ║
║ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ║
║ │numbers │ │ CLearscreen│ │ COLORs│ │ COMMAs│ ║
║ $PLOT │ │ ( │NOCLearscreen│ │NOCOLORs│ │NOCOMMAs│ ║
║ │? │ └ ┘ └ ┘ └ ┘ ║
║ │?AUTHOR │ ║
║ │?FLOW │ ┌ ┐ ┌ ┐ ║
║ │?SAMPLES│ │ 1 │ │ 1 │ ║
║ └ ┘ │INDEXStart sss│ │INDEXIncrement iii│ ║
║ │IStart sss│ │IIncrement iii│ ║
║ └ ┘ └ ┘ ║
║ ║
║ ┌ ┐ ┌ ┐ ║
║ │ 0 │ │NOLABELdatapoints│ ║
║ │LABELPoints iii│ │ LABELDatapoints│ ║
║ └ ┘ └ ┘ ║
║ ┌ ┐ ║
║ │ 0 │ ┌ ┐ ┌ ┐ ║
║ │LABELXpoints iii│ │NOLABELTags │ │LABELStart cccc│ ║
║ └ ┘ │ │ └ ┘ ║
║ ┌ ┐ │ () │ ┌ ┐ ║
║ │ 0 │ │ LABELTags cccc │ │LABELEnd cccc│ ║
║ │LABELYpoints iii│ └ ┘ └ ┘ ║
║ └ ┘ ║
║ ┌ ┐ ║
║ │MINUSE nnn│ ┌ ┐ ┌ ┐ ║
║ ┌ ┐ ┌ ┐ └ ┘ │ NORMalize│ │NOQuiet│ ║
║ │ 1 │ │ LOGs│ ┌ ┐ │NONORMalize│ │ Quiet│ ║
║ │LABELEVery nnn│ │NOLOGs│ │MAXUSE nnn│ └ ┘ └ ┘ ║
║ └ ┘ └ ┘ └ ┘ ║
║ ║
║ ║
║ ┌ ┐ ┌ ┐ ║
║ │NODUPlicates│ │ONLYINTegers│ ║
║ │NODUPs │ │ONLYINTs │ ║
║ └ ┘ └ ┘ ║
║ ║
║ ║
║ ║
║ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ║
║ │PLOTSEQuential│ │ SCALing│ │SCREENWidth www│ │SCREENDepth ddd│ ║
║ │PLOTSIMple │ │NOSCALing│ │SCRWidth www│ │SCRDepth ddd│ ║
║ │PLOTMULTiple │ └ ┘ │SWidth www│ │SDepth ddd│ ║
║ └ ┘ │WIDth www│ │DEPth ddd│ ║
║ └ ┘ └ ┘ ║
║ ║
║ ┌ ┐ ║
║ ┌ ┐ │ SIMplechars │ ┌ ┐ ║
║ │ SHOWLABels│ │ SIMplecharacters│ │ SINGlevalues│ ║
║ │NOSHOWLABels│ │NOSIMplechars │ │NOSINGlevalues│ ║
║ └ ┘ │NOSIMplecharacters│ └ ┘ ║
║ └ ┘ ║
║ ┌ ┐ ║
║ │SORTascending │ ┌ ┐ ┌ ┐ ┌ ┐ ║
║ │SORTDescending│ │NOSWAPAXises│ │XSINgles│ │.XXX=yyy│ ║
║ │SORTDUnique │ │ SWAPAXises│ │YSINgles│ └ ┘ ║
║ │SORTUnique │ └ ┘ └ ┘ ║
║ └ ┘ ║
║ ║
╚══════════════════════════════════════════════════════════════════════════════╝
 
───where: (all arguments are optional can be specified in any order, and
all options and/or values can be in lower/upper/mixed case.)
 
? shows this help file (press ESC to quit when viewing).
 
?AUTHOR shows the author of this program.
 
?FLOW shows the external execution flow of this program.
 
?SAMPLES shows some sample uses (press ESC to quit when viewing).
 
 
numbers are any number of valid REXX numbers seperated by blanks and may
be seperated by commas to help pairing of X,Y coordinates.
The numbers are assumed to be pairs of X,Y coordinates (the
default), or single values of the X or Y axis if the
SINglevalues option is specified. The SINX or SINY option
is used to specify which axis is be used for the single values.
 
( signifies that $PLOT options follow.
 
CLearscreen will clear the terminal screen before any output is
shown on the terminal. The default is CLEARSCREEN
 
COLORs uses colors when displaying the plot.
 
NOCOLOrs doesn't use colors when displaying the plot.
The default is: COLORS (for DOS or CMS),
NOCOLORS (for all other systems).
 
COMMAs specifies to commas are to be inserted into the numbers shown
for the labels (if shown). The default is: COMMAS
 
NOCOMMAs doesn't insert commas into numbers being shown for labels.
 
INDEXStart sss
IStart sss where sss is a number that is used to set (start) the
initial value of X (the default), or Y if
SINGLEVALUES is specified. The default is: INDEXSTART 1
 
INDEXIncrement iii
IIcrement iii where iii is a number that is used to increment either
the X or Y value (starting at INDEXSTART) if
SINGLEVALUES is specified.
The default is: INDEXINCREMENT 1
 
LABELPoints iii causes labeling of the data points with the left-most nnn
characters of the X and Y numeric values, seperated by
a comma. See the LABELXPOINTS and LABELYPOINTS options
below. This option, in effect, sets both LABELXPOINTS
and LABELYPOINTS to nnn. The data point label is
prefixed with the characters specified in LABELSTART and
suffixed " " " " " LABELEND, if any.
If LABELSTART or LABELEND aren't specified, they get their
values from LABELTAGS (unless NOLABELTAGS is specified).
The default is: 0
 
LABELXpoints iii causes labeling of the data points with the left-most nnn
characters of the X numeric value. If the value of X
is 3.45678 and LABELXPOINTS 4 is specified, the label
3.456 will be used. The default is: 0 (zero)
but takes its value from LABELPOINTS if not specified.
 
LABELYpoints iii causes labeling of the data points with the left-most nnn
characters of the Y numeric value. If the value of Y
is -3.45678 and LABELYPOINTS 4 is specified, the label
-3.4 will be used. The default is: 0 (zero)
but takes its value from LABELPOINTS if not specified.
 
NOLABELDatapoints doesn't label the data points.
The default is: NOLABELDATAPOINTS
 
LABELDatapoints turns on the LABELPOINTS 9 option if the
LABELPOINTS option hasn't been specified.
The default is: NOLABELDATAPOINTS
 
NOLABELTags causes no LABELTAGS to be used (set to null), but
LABELSTART and LABELEND can still be specified.
 
LABELTags cccc is any arbitary character string to be used for LABELSTART and
LABELEND, the first half is used for LABELSTART, the latter
half is used for LABELEND, the greater half (if an odd # of
characters is specified) is used for LABELSTART. Blanks can
be specified by using the underscore (_) character.
The default is: ()
 
LABELStart cccc is any arbitary character string to be used for the start of a
data point label. If not specified, the first (larger) half
of LABELTAGS is used. Blanks can be specified by using the
underscore (_) character. The default is: ( {if any}
 
LABELEnd cccc is any arbitary character string to be used for the end of a
data point label. If not specified, the last (smaller) half
of LABELTAGS is used. Blanks can be specified by using the
underscore (_) character. The default is: ) {if any}
 
LABELEVery iii will label every IIIth data point (if data points are being
labeled. The default is: 1
 
LOGs causes all normal (non-error) output (i.e., the plot) to be
logged (written to, or appended) to a file.
On CMS, the fileid is: $PLOT ANS A5
On TSO, the fileid is: $PLOT.ANS
On DOS, the fileid is: \temp\$PLOT.ANS -where temp is the
value of the TEMP environment var, if not found, TMP is used.
The default is: NOLOGs
 
MINUSE nnn is the minimum number to be used in the plot. Any number below
this is ignored. There is no default.
 
MAXUSE nnn is the maximum number to be used in the plot. Any number above
this is ignored. There is no default.
 
NORMalize will normalize all the numbers specified. Any leading plus
signs are removed, including leading or trailing trivial zeros,
superflous decimal points, and exponentation.
The default is: NORMALIZE
 
Quiet indicates that no output is shown. The default is: NOQUIET
 
DUPs
DUPlicates will show duplicate results. The default is: DUPLICATES
 
NODUPs
NODUPlicates won't show duplicate results. The default is: DUPLICATES
If any result (to be shown) is a duplicate, it isn't shown. The
first result is shown, however, any subsequent duplicates aren't.
The comparison is performed after adding any commas, ajusting
the case, normalizing the number, or adjusting the precision.
 
ONLYINTegers
ONLYINTs won't plot numbers that aren't an integer.
The default is to allow all numbers.
 
PLOTSIMple does a simple plot, with a point (∙) to show the datapoint. Any
plot point overlaying an another plot point simple shows one point.
The default is: PLOTSIMPLE
 
PLOTSEQuential each plot is plotted with a point (∙) followed by the number of
the data point, starting with 1. The default is: PLOTSIMPLE
 
PLOTMULTiple each plot is plotted with a point, unless another point has been
already plotted, in that case, the next point in the list is
used to show the data point. The point list is: ·∙OΘ≡■▒▓█+
If the list is exausted, a plus sign (+) is used.
 
SCALing will scale the X and Y axis data points to the best fit on the
terminal screen. The default is: SCALing
 
NOSCALing won't scale the X and Y axis data points to the best fit on the
terminal screen. In effect, the NOSCALING option will preserve
the aspect of the X and Y values. The default is: SCALing
 
SCREENWidth www specifies the width of the terminal screen. If not specified
SCRWidth www or a value of 0 (zero) is specified, the screen width is
SWidth www obtained from the operating system.
WIDth www If not obtainable, a value of 80 is assumed.
Because of some terminal's behavior, the actual
width used is SCREENWIDTH - 1
 
SCREENDepth ddd specifies the depth of the terminal screen. If not specified
SCRDepth ddd or a value of 0 (zero) is specified, the screen depth is
SDepth ddd obtained from the operating system.
DEPth ddd If not obtainable, a value of 24 is assumed.
Because of certain operating systems, three lines
are assummed to be used for prompts, etc, so the
actual depth used is SCREENDEPTH - 3
 
SHOWLABels shows the values of the minimum and maximum values plotted,
including 0 (if it's on the plot). The default is: SHOWLABels
 
SIMplechars
SIMPLEcharacters translates extended characters to "simple" characters.
This option affects boxing characters and foreign non-Latin alphabet
characters in the month and day-of-week names.
The default is: NOSIMPLEcharacters
 
SINglevalues will cause the numbers specified to be plotted as single values
(instead of being plotted as X and Y coordinates).
The default is: NOSINGLEVALUES
 
NOSINglevalues will cause the numbers specified to be plotted as X and Y
coordinates. The default is: NOSINGLEVALUES
 
SWAPAXises will swap the data points so that:
all X points will plot on the Y axis, and
all Y points will plot on the X axis.
The default is: NOSWAPAXISIS
 
NOSWAPAXises won't swap the data points on each axises..
 
SORTascending sorts the data points in ascending order.
This option only can be in effect for SINGLE values.
The default is to plot the data points in the order specified.
 
SORTDescending sorts the data points in descending order.
This option only can be in effect for SINGLE values.
The default is to plot the data points in the order specified.
 
SORTDUnique sorts the data points in descending order, and any duplicate
data points are not plotted.
This option only can be in effect for SINGLE values.
The default is to plot the data points in the order specified.
 
SORTUnique sorts the data points in ascending order, and any duplicate
data points are not plotted.
This option only can be in effect for SINGLE values.
The default is to plot the data points in the order specified.
 
XSINgles will cause a sequence of generated numbers to be used for the X
coordinates starting at INDEXStart (normally 0) and
to be incremented by INDEXIcrement (normally 1) if the
SINGLEvalues option is specified. The default is: NOSINX
The Y axis numbers are taken from the specified list.
 
YSINgles will cause a sequence of generated numbers to be used for the Y
coordinates starting at INDEXStart (normally 0) and
to be incremented by INDEXIcrement (normally 1) if the
SINGLEvalues option is specified. The default is: NOSINY
The X axis numbers are taken from the specified list.
 
.XXX=yyy are any options to be used by the $T program (which is used to
display the histogram. Possible uses are to specify a color
(.C=color) for the histogram. For more info, issue: $H $T
 
Ω
</pre>