Two demo programs are shipped with the source distribution. Both require GTK4, Cairo, and Pango (via pkg-config). Build with the standard autotools sequence:
autoreconf -fi && ./configure && make
The two programs produced are sciplot-xyplot and sciplot-realtime.
The sciplot-xyplot program takes a text file (or standard input) as input and plots the data as x/y or polar plots. More than one set of data may appear in a single plot frame, and more than one plot frame may be displayed at once. As shown in the screen shot, many widget features are available as interactive controls before generating a PostScript copy.
sciplot-xyplot [OPTION...] [FILE...]
sciplot-xyplot accepts one or more input files on the command line, or reads from standard input if none are given. Use --help for a full option list and --version for version information.
There are five commands recognised in the input file. Optional items are enclosed in [square brackets].
The keyword skip may appear in place of a data line to break the line into disjoint segments (see SCIPLOT_SKIP_VAL).
Text labels should be enclosed in double-quote characters.
Title="Crack Growth Comparison" Xaxis="Number of Cycles (kc)" Yaxis="Crack Depth (mm)" Line="25% strain" 0.000000e+00 2.000000e+00 1.373497e+02 2.500000e+00 2.403780e+02 3.000000e+00 skip 3.205736e+02 3.500000e+00 3.845680e+02 4.000000e+00 Line="50% strain" 0.000000e+00 2.000000e+00 3.480081e+01 2.500000e+00 6.082956e+01 3.000000e+00 skip 8.105608e+01 3.500000e+00 9.719518e+01 4.000000e+00 Line="100% strain" 0.000000e+00 2.000000e+00 4.212263e+00 2.500000e+00 6.219232e+00 3.000000e+00 7.458972e+00 3.500000e+00 8.387889e+00 4.000000e+00
sciplot-realtime reads whitespace- or comma-separated numeric data from standard input and updates the plot as each line arrives.
One sample per line. Lines beginning with # are ignored.
| Columns per line | Interpretation |
|---|---|
| 1: y | Single Y series; X auto-increments from 0 |
| 2: x y | Explicit X and one Y series |
| N: x y1 y2 … | Explicit X and N−1 Y series |
The number of series is fixed by the first data line. When standard input reaches EOF the plot window stays open for interactive use (axis toggles, PostScript export, etc.).
| Option | Description |
|---|---|
| -t, --title TEXT | Plot title (default: "Real-time Data") |
| -x, --xlabel TEXT | X axis label |
| -y, --ylabel TEXT | Y axis label |
| -l, --legend NAME,... | Comma-separated series names |
| -V, --version | Show version and exit |
| -h, --help | Show help and exit |
sciplot-realtime [OPTION...]
Examples:
# Plot a single sensor channel
sensor-tool | sciplot-realtime --ylabel "Temperature (C)"
# Plot multiple channels with named series
multi-sensor | sciplot-realtime --legend "ch1,ch2,ch3" --xlabel "Sample"
# Non-interactive preview of a data file
sciplot-realtime < data.txt
# Plot ping round-trip times
ping host | awk '/time=/{gsub(/.*time=/,""); gsub(/ .*/,""); print}' \
| sciplot-realtime --ylabel "RTT (ms)"