# SciPlot Demo Program

- Compilation Instructions
- x/y plotter
  - Screen Shots
  - Usage
  - Input File Format
  - Sample Input File
- Realtime Demo
  - Usage

- SciPlot General Info
- Programmer's Documentation

## Compilation Instructions

Shipped with the source code distribution are two demo programs that show some of the features of the SciPlot widget.

The tests are in `tests/SciPlot`.

## x/y plotter

The SciPlot Demo program takes a text file (or standard input) as input and plots the data from that file as x/y or polar plots. More than one set of x/y (polar) line data may appear in a single plot frame, and more than one plot frame may be displayed on the screen. As shown in the plot frame controls , many features of the SciPlot widget are available for customization before generating a postscript copy.

### Screen Shots

### Usage

The SciPlot Demo program is made automatically when compiling the SciPlot Widget source code, as shipped. It is called "sciplot" and is executed by typing:

`sciplot data.txt`

where data.txt is a sciplot input file, described below. Note that sciplot can also read multiple input files on the same command line, or read from standard input.

### Input File Format

There are 5 commands that sciplot recognizes in the input file. Optional items are enclosed in [square brackets].

Title [title]
  Signifies the start of a new plot, and optionally specifies the title for the plot.
Xaxis [x axis label]
  Optional x axis label
Yaxis [y axis label]
  Optional y axis label
Polar [rad]
  Polar plot flag. If not present, the form is assumed to be a cartesian (x/y) plot.
Line legend-label
  Begins a new line of data to be added to the current plot. The values to be added immediately follow this line in the input file; and the program will continue to add lines until another command is reached, or the file ends.

  Data is free format, but must be separated by a comma, equal sign, or whitespace. Both the x and y (r and theta) coordinates must appear on the same line of text in the file.

  In place of a line of x/y data, the keyword "skip" may be substituted. This causes a break in the current line, which allows lines to contain multiple disjointed line segments.

Any text labels in the file should be enclosed in quotation characters.

### Sample Input File

    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

## Realtime Demo

This is just a simple program that uses the realtime updating capabilities of the widget. Instituted in the program is a timed callback (XtAppAddTimeOut) that simply randomly increments one of the points every half second. The plot is redrawn after every update.

### Usage

Just execute the program "realtime" to see this demo. It takes no arguments.

SciPlot : Programmer's Reference | Demo Programs