Example: Creating and Customizing a Simple 2D Graphs Menu Graph

This example illustrates methods for continuing exploratory analysis of graph data after a graph is initially created. For this example, open the Irisdat.sta data file:

Ribbon bar. Select the Home tab. In the File group, click the Open arrow and on the menu, select Open Examples. The Open a Statistica Data File dialog box is displayed. Irisdat.sta is located in the Datasets folder.

Classic menus. On the File menu, select Open Examples to display the Open a Statistica Data File dialog box; Irisdat.sta is located in the Datasets folder.

This data file, based on the classic example data of Fisher (1936), contains measurements made on length and width of flower parts (sepals and petals) and the corresponding iris flower type (Setosa, Versicol, and Virginic). In this example, we will explore the relationship between two of the variables: sepal length (Sepallen) and petal length (Petallen).

Producing the Graph

Ribbon bar. Select the Graphs tab. In the Common group, click Scatterplot to display the 2D Scatterplots Startup Panel.

Classic menus. On the Graphs menu, select Scatterplots to display the 2D Scatterplots Startup Panel.

On the Quick tab, click the Variables button to display a standard variable selection dialog box.

For the X axis, select Petallen, and for the Y axes, Sepallen.

Click the OK button.

In the 2D Scatterplots Startup Panel, select the Advanced tab.

Note that, by default, a Linear fit is specified for the graph.

Marking SelectedSubsets

In order to explore possible differences in the relationship between sepal length and petal length from flower type to flower type, we want to display the flower types separately on the graph. To do this:

The Specify Multiple Subsets dialog box will look as follows:

Click the OK button in this dialog box.

Click the OK button in the 2D Scatterplots Startup Panel to produce the graph.

Adding a New Fit Line

On examination of the graph, it is obvious that the linear relationship displayed is very strongly influenced by the presence of the compact group of Setosa measurements that occur at lower values of both Petallen and Sepallen. It would be of some interest perhaps to explore the relationship between these variables within the Virginic-Versicol group, which on initial examination appears to have a slightly different trend than that calculated for all flower types together. Specifically, we want to add another linear regression line to the plot that includes only the data in the Versicol and Virginic groups.

Restricting the Range of the Fit

By default, this fit will be Linear as shown in the Fit type box. We will leave it as linear, although we could easily specify another fit type at this point. We want, however, to restrict this fit to the Versicol and Virginic data. Therefore:

Adding Custom Axis Labels and Limit Lines

Now we want to display the lower and upper limits of the Versicol and Virginic data used in the new fit.

Customizing the Legend

Next, we will customize the legend. Double-click on the graph's outer background to once again display the Graph Options (graph customization) dialog box.

On the Graph: Titles/Text tab, the text items associated with the graph legend can be deleted, changed, or supplemented. Note that the Graph Titles/Text dialog box can be displayed directly by double-clicking on the legend.

To change properties of the symbols in the legend (i.e., point markers or fit lines) double-click on the item in the graph or access the item on the appropriate tab of the Graph Options dialog box (i.e., Plot: General to change point markers or Plot: Fitting to change the properties of the fit line). Changing the properties of these items on the graph automatically makes the changes in the legend symbols.

Changing Titles and Axis Titles

Finally, we will change the titles and axis titles. Double-click on any graph title or axis title to display a dialog box with options to customize that title. Note that axis titles and graph titles can also be accessed from the Axis: Title and Graph Titles/Text tabs, respectively, of the Graph Options dialog box.

The completed graph (shown above) incorporates changes to legends and titles and the addition of labels and gridlines defining the range of data incorporated into the newly added fit.