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 located in the Examples\Datasets subfolder of your STATISTICA installation folder. You can open it using the File - Open Examples menu (the data file is in the Datasets folder), the Open Data button on any Startup Panel, or the toolbar button. 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

Marking selected subsets

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

Click the OK button on this dialog and on the 2D Scatterplots dialog to produce the graph shown below:

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. In the Graph: Titles/Text options pane, the text items associated with the graph legend can be deleted, changed, or supplemented. Note that the Graph Titles/Text dialog can also 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 in the appropriate options pane of the Graph Options dialog (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 that is used to customize that title. Note that axis titles and graph titles can also be accessed from the Axis: Title and Graph Titles/Text options panes, respectively, of the Graph Options dialog.

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.