Xmgr: plot functions

## Plot functions

The selections in the Plot pulldown menu allow the modification of plot parameters. There are popups for setting the scaling of the axes, the number of tick marks to display, legends, writing annotative text, and drawing objects such as lines and boxes.

xmgr uses 3 coordinate systems in drawing a graph. These are the world, viewport, and device coordinate systems (following Foley and Van Dam). The world coordinates system is the one in which the data are defined and constitutes the user's coordinate system. The viewport coordinate system (in xmgr), is a rectangle defined by the points (0.0, 0.0) or the lower left corner of the device and (1.0, 1.0) or the upper right corner of the device. The pipeline for drawing objects on the screen or hardcopy device is a pair of linear transformations that carry points in world coordinates to the viewport and then on to the device coordinate system. The upshot is that an object located in world coordinates can be drawn in various parts of the screen or hardcopy device depending on the scaling while an object located in viewport coordinates remains in the same spot regardless of the world scaling. Strings, lines, boxes, and the graph legend can be located in either world or viewport coordinates.

- World scaling
- Viewport
- Autoscale
- Titles
- Ticks labels/tick marks
- Frame
- Symbols
- Error bars
- Legends
- Strings & Things
- Time stamp

### World scaling

Define the world coordinate system by filling in the items Xmin, Xmax, Ymin, and Ymax. The plot is drawn in world coordinates in a rectangle described by the two points (Xmin, Ymin), (Xmax, Ymax). The input is scanned for arithmetic expressions so setting Xmin = -PI and Xmax = PI is legal input (see the section on transformations for a description of the syntax and available functions). The tick spacing can also be set in this popup by filling in the items for the major and minor spacing for each axis. `Update world/ticks' is used, when, occasionally, the state of the items used to define the world scaling get out of sync with what is actually used to draw the graph, clicking on this item synchronizes the internal values with the displayed values. Press the button marked Accept to inform xmgr of the changes.

Note: make sure Xmin < Xmax and Ymin < Ymax.

### Viewport

Define the viewport by filling in the items Xmin, Xmax, Ymin, Ymax. Viewport coordinates run from (0.0,0.0), the lower left corner of the screen or hardcopy device, to (1.0,1.0), the upper right corner of the screen or hardcopy device. Press the button marked Accept to make the change to the new viewport. Press the Pick view button to use the mouse to define the viewport. Take the mouse to the lower left corner of the desired viewport and press the left button (there is no need to hold the button down). A rubberband box will show you the current size of the viewport you may select. When you are satisfied with the view, press the left mouse button again to activate the new viewport.

Press the button marked Close to close the Viewport popup.

The viewport can also be changed by double clicking on the focus markers (or where they would be placed if not shown). The new location is chosen by clicking the first mouse button.

### Autoscale

Use the Autoscale popup to set parameters associated with autoscaling. Select the axis to scale, or none. Selecting none allows the autoscale type and the number of ticks to create to be set but no autoscaling is done. Select the particular set to use or All. The Autoscale type sets the method of autoscaling, either Auto or fixed. Auto uses a method based on routines posted to the net by Paul Heckbert and generates nice looking tick spacing, but alters the scaling of the axes. The fixed option uses the minimum and maximum values in the set (or over all sets) to set the scale of the axes. Select the number of tick marks to use for defining the tickmark spacing (in the case of Heckbert scaling, these settings are advisory only). The item labeled Apply to: allows the autoscaling of the current graph, or all active graphs.

### Title/subtitle

The title and subtitle are strings that appear centered at the top of the plot. Fill in the items indicated and press the button marked Accept. To change the font, color, or character size used for titles use the items from the popup denoted Props....

### Ticks/tick labels

Set the spacing and type of major and minor tick marks, definition of axes labels, and toggle features associated with the drawing of the graph axes.

The top item, Edit, selects the axis for which the feature selections will apply. There are two axes defined for each co-ordinate direction, the primary axis and the zero axis. The primary axis will be used the most, the zero axis is, by default, turned off. The button to the right of the Edit item labeled Props... allows the axis to be offset by a specified amount in viewport co-ordinates. The item Axis label accepts the definition of the label to be used when drawing the axis. Various properties of the label may be set in the popup just below labeled Axis label props....

The two items `Major tick spacing' and `Minor tick spacing' set the spacing of major and minor ticks. Tick labels are drawn based on the setting for the major tick spacing. These items are duplicated in the `Define world' popup described previously. Fill in the appropriate blanks and press Accept to refresh the display. The units are positive deltas starting with the world minimums. Input is run through the scanner so expressions are allowed. The are special symbols dx and dy for setting a prescribed number of tick marks. Dx is the distance along the X-axis and dy is the distance along the Y-axis, as defined in the current window of the world coordinate system. Typing at Major tick spacing "dx/10" will give 10 major tickmarks.

Tick labels, tick marks, the axis bar, may be toggled by the check boxes. Properties for each of these can be set by the Props... popups associated with each item.

Properties for tick labels are:

Font
  Which font to use when drawing the labels.
Color
  Which color to use.
Line width
  Width of line to use when drawing the label.
Char size
  Size of characters to use.
Format
  Decimal, exponential, power, general plus several time and date formats. To use the time and date formats, the data are required to be in Julian Date format, the long version. Two auxiliary programs, jul2greg and greg2jul, are available with the distribution to assist in the conversion from Julian to Gregorian date formats.
Stagger
  each tick label may be offset with respect to its neighbor, the levels of staggering ranging from 0 to 3, This is especially useful with some of the time and date formats.
Precision
  sets the number of places to display to the right of the decimal point for the labels.
Skip every
  tick labels are drawn at every major tick mark, use the skip factor to circumvent this.
Start labels at
  Graph minimum, or specified. To start the labels at some other point than the graph minimum, fill in the text item to the immediate right with the value where tick labels are to begin. There is a similar item in the property sheet for tick marks that can be used to set where the major tick marks begin. between these two, there should be sufficient flexibility.
Stop labels at
  same as above only works at the other end of the axis.
Layout
  allows the tick labels to be drawn horizontally, vertically, or a specified angle (in degrees).
Draw tick labels
  which side of the graph to draw tick labels, either the normal side (the bottom of the graph in the case of the X-axis, or to the left of the graph in the case of the Y-axis), The opposite side, or both. This can be handy when using multiple axes, or overlaying graphs with differing scales.
Sign
  allows the numerical value of the label to be displayed as is, as its absolute value, or negated. This can be used to effectively reverse the sense of the axis (negate), or reflect the axis about zero (absolute value).
Apply to
  Override the selected axis from the Ticks/tick label popup, causing the settings to be selected for all axes in the current graph, the current axis for all graphs, or all axes in all graphs.

Press the button Accept when everything is OK, or Close to close the popup.

Properties for tick marks are:

Tick mark direction
  in, out, or both. Which direction the ticks point.
Tick marks on
  Which side of the graph to draw ticks. The normal side is the bottom of the graph in the case of the X-axis, or to the left of the graph in the case of the Y-axis, the default is to draw ticks on both sides.
Major tick length
  sets the length of major tick marks
Minor tick length
  sets the length of minor tick marks
Major grid lines
  a check box that when toggled on, grid lines will be drawn at the settings for major tick marks.
Minor grid lines
  a check box that when toggled on, grid lines will be drawn at the settings for minor tick marks.
Color, line width, and line style
  These items set the characteristics of the lines use to draw ticks and grid lines.
Apply to
  allows the axis select in the Ticks/tick label popup to be overridden, causing the settings to be selected for all axes in the current graph, the current axis for all graphs, or all axes in all graphs.

  Press the button Accept when everything is OK, or Cancel to close the popup.

  Properties for the axis bar are:

  Color, line width, and line style items set the characteristics of the lines use to draw ticks and grid lines.

Press the button `Accept' when everything is OK, or `Cancel' to close the popup.

IMPORTANT NOTE FOR LOG PLOTS: When log scaling is selected for a particular axis or axes, the meaning of major and minor ticks changes slightly. Major ticks should be set to integer values. Use minor ticks to set the number of interdecade tickmarks, these should be set to integer values ranging from 0 (no interdecade tickmarks) to 5. A value of 1 will draw each interdecade position, 2 will skip every other position, etc.

### Frame

The frame is the box drawn around the clipping region of the graph, and the region inside. Items in the frame popup are:

Frame
  Turn the frame on or off.
Style
  Either `closed' or `open.
Color
  Set the color of the line drawn around the graph.
Line width
  Set the width of the line around the graph.
Line style
  Set the line style of the line.
Fill graph background
  Toggle the filling of the frame.
Background color
  The color with which to fill the frame.

Press Accept to register the settings, Close to close the popup.

### Symbols

The items in the symbols popup allow the selection of symbols, lines, and fill style to be used when drawing a set.

Items in the symbols popup are:

Select set
  The set or sets to which the following items will apply. Multiple selections may be activated.

  Symbol:

Symbol
  Select the symbol to use, or none for no symbol.
Fill
  Select the fill option, none, filled, or opaque. The opaque option allows the symbol to be filled with the background color (white as of this writing) overwriting the line used to connect each point.
Size
  Set the size of the symbol.
Char
  select a character to use instead of a symbol (not active)
Skip
  select the number of points to skip when drawing symbols

  Line:

Style
  select the line style for the lines connecting the points in the set.
Width
  select the line width for the lines.
Color
  the color to use when drawing lines.

  Fill:

Fill
  select the type of fill, none, as polygon, to y=0.0, x=0.0, x=graph Xmin, x=graph Xmax, y=graph Ymin, y=graph Ymax.
Fill using
  either Color or Pattern.
Color
  select the color to use, or none.
Pattern
  select the pattern to use or none There are three additional buttons in this popup that can be used to set the colors, symbols, and line widths in an incremental fashion, avoiding the need to specify a each.

  Misc:

Legend
  A string defining the legend to use for this set
Select
  Allow single or multiple choices in Select set
All colors
  Assign a different color to each set
All symbols
  Assign different symbols to each set
All widths
  Cyclically Assign different line widths to each set
All line styles
  Cyclically assign different line styles to each set
B/W
  Make all line colors black

  Misc:

Legend
  A string defining the legend to use for this set
Select
  Allow single or multiple choices in Select set
All colors
  Assign a different color to each set
All symbols
  Assign different symbols to each set
All widths
  Cyclically Assign different line widths to each set
All line styles
  Cyclically assign different line styles to each set
B/W
  Make all line colors black

  NOTE: There are limits on how large a set can be for the fill to operate correctly. The limit for the display is approximately 8000 points, for the hardcopy drivers, this limit drops to around 800-1000.

Symbols descriptions:

- 1. No symbol
- 2. Dot
- 3. Circle
- 4. Square
- 5. Diamond
- 6. Triangle up
- 7. Triangle left
- 8. Triangle down
- 9. Triangle right
- 10. Plus
- 11. X
- 12. Star
- 13. Impulse at X
- 14. Impulse at Y
- 15. Vertical line at X
- 16. Horizontal line at Y
- 17. Histogram X
- 18. Histogram Y
- 19. Stair step X
- 20. Stair step Y
- 21. Bar X
- 22. Bar Y
- 23. Range
- 24. Location
- 25. Set #
- 26. Set #, location
- 27. Bar and whisker (not active as of this writing)
- 28. Segments
- 29. Character
- 30. String (not active as of this writing)
- 31. Hi low X
- 32. Hi low Y
- 33. Open/close X
- 34. Open/close Y

NOTE: symbols 16-29 do not appear in the legends

### Error bars

Error bars are created by reading in the data as a set with error bars (see Files above). Properties of error bars are set by opening the `Error bar props' popup.

Size
  Set the length of the error bar.
Line width
  Set the line width of the error bar.
Line style
  Set the line style of the error bar.
Riser
  Toggle the display of the line connecting the error bar with the data point.
Riser line width
  Set the width of the riser.
Riser line style
  Set the riser line style.
Display
  Toggle the display of the error bar.

### Legends

Legend items:

Legend on/off
  toggle the display of the graph legend
Legend location type
  Select the coordinate system to use when interpreting the legend x, and legend y items described below. Either the world or viewport coordinates. Legends placed in viewport coordinates make the legends stay put as the plot scale changes. Legends placed in world co-ordinates will float as the graph scaling is changed.
Legend gap
  specify the vertical gap between legend entries
Legend length
  specify how long the line representing the set should be.
Legend X
  X value of legend location
Legend Y
  Y value of legend location
Font
  specify the font for the legend labels
Frame
  toggle a box drawn around the legend. The three items below set the line color, line width, and line style of the box.
Fill frame
  toggle the fill of the box around the legend. The frame fill will obliterate anything beneath, grid lines, sets, etc. Set the type of fill either color or pattern and the corresponding color or pattern.

Clicking Place is a convenient method of placing the legend on the canvas. After pressing this button, move the mouse pointer to the desired location and press again with the left button. The location will be in world or viewport coordinates as selected above.

Press Edit... to edit legend labels.
  - To edit a label, click on the desired set or use arrow keys and enter the label in the Label area. Press return to enter the change in the set list and then press Accept to apply it to the graph.
  - Load comments will make the set comments the legend labels.
  - Strip labels will remove the leading component of a pathname and leave only the basename.

Press the button marked Accept to register the legend settings.

Press the button marked Close to close the popup.

### Strings & Things

The numbers of strings, lines, boxes and ellipses are fixed, open Help/About to see what the limits are for your version of xmgr.

To define a text string to be drawn on the canvas:

  Select font, pen, justification, rotation (in integer degrees [0,360]), size. Press the button marked "Text" to activate the text writing routines. Move the mouse to the canvas and press the left mouse button at the desired location and type away. It is possible to use control codes to change fonts within the string. Press <return> to advance to the next line - the right mouse button to stop. Each line of text is a separate object. The text cursor does not behave properly for rotated strings. To redefine string parameters you'll need to press the right button to leave text mode - adjust the parameters and press "Text" again to inform xmgr of the changes and resume writing. See below for an explanation of world/viewport positioning.

  To click on a text string, the cursor must be placed near the origin of the text string. The origin will be the lower left corner of the string for left justified strings, the right side for right justified strings and in the center for center justification.

  NOTE: It is necessary to press <return> to register the string.

Edit string
  Click on the string you want to edit. A cursor will appear at the end of the string which may be moved using the left and right arrow keys. Anything typed will be inserted at the cursor and backspacing will delete the character before the cursor. In addition, the following control characters have special meanings:

  ^a - Move editing cursor to beginning of string

  ^e - Move editing cursor to end of string

  ^u - Delete beginning of string to cursor

  ^k - Delete to end of string

To define a line, box or ellipse to be drawn on the canvas:

  Set the properties of the object you want to draw by selecting box/line/ellipse props...

  The cycle "Position in: World | viewport coordinates" allows the object position to be defined in the world coordinate system or viewport coordinates. In World coordinates, the object position and aspect ratio on the display change as the plot is re-scaled. Specifying the object in viewport coordinates will force the object to remain in the same place and retain the same aspect ratio as the plot scale is changed.

  When the cursor turns to cross-hairs, the two points defining the object may be specified. A line is defined by its end points while a box is defined by its opposing corners. An ellipse is defined by the opposing corners of the rectangle enclosing it.

Selecting an object

  For the following three operations, one must select an object. This is performed by clicking the left mouse button near one of the defining points of an object. Only objects associated with the current graph will be selected. Objects are associated with the graph that was active at the time of their creation. The defining points of objects are given below

  box
    corners
  ellipses
    corners of bounding box
  line
    end points
  text
    origin (justification dependent)

Move object:

  To move a line, box, ellipse or string:

  Press the button marked "Move", this should change the cursor to the "move" cursor.

  Select the object to be moved. The object will now be drawn with the first point used to define the object under the cursor.

  Move the cursor to the new location and press the left mouse button.

Delete object:

  Press the button marked "Delete", this should change the cursor to a bullseye cursor.

  Select the object to be deleted.

Edit object:

  Click on edit and then select an object.

  The attributes of an object may be changed after it has been defined by clicking on the object. Editing may be used to redefine a line, box, ellipse or string.

  The World<->View button is used to interchange between world and viewport specification of object placement. The object will remain at the same spot when converted from one coordinate system to the other.

NOTE: The right mouse button cancels all operations (true throughout xmgr with respect to mouse operations).

### Time stamp

Set the display of a string containing the current time. This string is updated each time the graph is redrawn.