Graph Features

Statistics101 displays graphs in tabs in its Output Window. Here is an image of Statistics101 showing the tabs for eight graphs created with the XYGRAPH and SCATTERGRAPH commands. Only one graph shows at a time, of course.

The main feature of the Output Window when it is showing one or more graphs is the set of tabs at the top that are used for selecting which graph to view. The first tab is always labeled "Output" and is the main Output Window that displays the textual output of your Statistics101 programs. Each of the other tabs is created by a single XYGRAPH or SCATTERGRAPH or HISTOGRAM command and has a name that you can set in the command.

You can cycle through the tabs using the right or left arrow keys on your keyboard.

If there are too many tabs to fit within the width of the window, then the tabs are "wrapped" (by default) into multiple rows as shown above. If you would prefer them to display as one row with a scroll handle, then you can open the Preferences dialog using the Edit>Preferences... menu, go to the "Graphs" tab and check the "Scroll graph tabs" check box, then click OK.

You can left-click on any tab and, holding the button down, drag the tab to a new position in the row of tabs until the colored highlight appears indicating a legal drop point, then release the button. The tab will take up the new position. This next figure shows how the dragged tab appears just before it is dropped into a new position.

You can access a popup menu on any tab as shown in this figure:

The popup menu will let you close the selected tab (except the Output Window), or close all tabs to its left, or all tabs to its right, or all other tabs, or all tabs. The tab labeled "Output", which contains the original textual Output Window, will remain as long as there is at least one graph tab present. When the last graphical window tab is removed, the output tab will disappear, but the Output Window will remain, filling the output panel. The last menu item is labeled "Scroll tabs" or "Wrap tabs", depending on the current state of the tab layout options. The effect of this menu is only seen when there are too many tabs to fit within the width of the main window. When the "Wrap" option is in force, the excess tabs are shown in rows, with all tabs visible. When the "Scroll" option is in force, only one row of tabs is shown and the excess are hidden off-screen. In this case (scroll), in order to see the hidden tabs you need to click on the scroll bar that appears.

Each tab after the Output tab is associated with a single graph. The main features of a graph are its horizontal and vertical axes, its legend, and of course the graph itself. Each axis has a label and a numerical scale. The axes titles are set by the graphical command to names from the argument list or to names you provide in the command. The scale is determined automatically by the command. See each command for specifics.

The legend is built automatically by the command and shows which color or line type is associated with each "Y" vector.

As you move the mouse pointer over the graph you will notice that a crosshair and an annotation will follow the mouse. The annotation's first line gives the X and Y values at the mouse pointer. The other lines list the Y values associated with that X value for each of the curves in the graph. Here is an example.

The last main feature of the graph is the popup menu that appears over the graph when you trigger it by right-clicking or by whatever serves as the popup trigger in your operating system. It allows you to control and change some of the graph's characteristics. Here's what the menu looks like:

Here is the functionality of each menu item:

Some menu items will be disabled depending on the type of the graph. For example, in graphs created by SCATTERGRAPH, the Interpolate and the Use Dashed Lines menu items are disabled because they do not apply.

Some graph types may have additional items added to the menu, that apply only to that menu type. For example, on the HISTOGRAM graph, the menu has a submenu ("Histogram Options") that allows you to select whether the cumulative distribution values and/or inverse cumulative distribution values will be shown in the graph's annotation.

Now that you have the general idea of how the graphic commands and displays work, you can cut and paste the following program into Statistics101 and explore a number of different examples.

'Make a scatter chart of a 2-dimensional normal random variable:
NORMAL 1000 0 1 NormalX
NORMAL 1000 0 1 NormalY
SCATTERGRAPH "Normal Scatter" normalX normalY

'Make a scatter chart of a 2-dimensional uniform random variable:
UNIFORM 1000 -1.0 1.0 UniformX
UNIFORM 1000 -1.0 1.0 UniformY
SCATTERGRAPH "Uniform Scatter" uniformX uniformY

'Plot the first 100 squares on log and loglog graphs:
COPY 1,100 Numbers
SQUARE numbers Squares
XYGRAPH log numbers squares
XYGRAPH loglog "LogLog Squares" numbers squares

'Plot a scattergraph and an xygraph of sines and cosines:
INCLUDE "lib/mathConstants.txt"
MULTIPLY 1,180 5 degrees
MULTIPLY degrees degToRad radians
SIN radians sines
COS radians cosines
DIVIDE pi 4 piOver4
ADD piOver4 radians offsetrads
SIN offsetrads offsetSines
SCATTERGRAPH "Circular Functions" degrees sines degrees cosines degrees offsetSines
XYGRAPH "Circular Functions" degrees sines cosines offsetSines

'Make a spiral and plot it on both scattergraph and xygraph:
MULTIPLY 1,720 degToRad thetaRadians
SIN thetaRadians sines
COS thetaRadians cosines
COPY 1,720 radius   'Need one radius for each angle, theta
MULTIPLY radius sines Y
MULTIPLY radius cosines X
SCATTERGRAPH "Scatter Spiral" x y
XYGRAPH "Line Spiral" x y