Chapter 9. Fundamentals of Graphing

In This Chapter

  • Creating graphs easily

  • Building graphs the quick way

  • Building graphs the old way

  • Editing graphs

Over the years, the SPSS software has improved its methods for generating graphic displays of data. You can take the easy way and be guided through every step, or you can take a faster way and simply enter the values needed to build the graph you want. The older methods of producing graphs as output are still available and on the menu, so if you like to suffer while you work, you can use the procedures developed in previous years. In any case, you never have to worry about the size of text and graphics, and you don't have to think about the placement of the graph on the page — SPSS does all the grunt work for you.

SPSS can display your data in a bar chart, a line graph, an area graph, a pie chart, a scatterplot, a histogram, a collection of high-low indicators, a box plot, or a dual-axis graph. Adding to the flexibility, each of these basic forms can have multiple appearances. For example, a bar chart can have a two- or three-dimensional appearance, represent data in different colors, or contain simple lines or I-beams for bars. The choice of layouts is almost endless.

Tip

In the world of SPSS, the terms chart and graph mean the same thing and are used interchangeably.

Note

The Graphs menu in the SPSS Data Editor window has three options: Chart Builder, Graphboard Template Chooser, and Legacy Dialogs. These options are different ways of doing the same job. If you prefer to build graphs in SPSS the original way, of course, you can choose Legacy Dialogs. A better way of building graphs was devised a few years later — the Graphboard Template Chooser — and when it hit the scene, the original way of building graphs became known as Legacy. A few years later, an even better procedure for building charts was devised and added to the menu — Chart Builder. All three building methods are in place primarily for people who are in the habit of using the older procedures, but if you build a lot of graphs, you may find advantages and uses for all of them. You can get the same graphs from all three; only the process is different.

Building Graphs the Easy Way

SPSS contains Chart Builder, which uses a graphic display to guide you through the steps of constructing your display. It checks what you're doing as you proceed and won't allow you to use things that won't work. If the OK button is available for clicking after you've defined what you want as a result, that means that everything is ready and a chart will be produced.

Gallery tab

The following example steps you through the process of creating a bar chart, but you can use the same fundamental procedure to build a chart of any design. You can follow this tutorial once to see how it all works. Later on you can use your own data and choices.

Tip

You can't hurt your data by generating a graphic display. Even if you thoroughly mess up the graph, you can always redo it without fear. This is one place where mistakes don't cost anything. And nobody's watching.

The following steps build a bar chart:

  1. Choose File

    Gallery tab
    Open
    Gallery tab
    Data and load the
    1991 U.S. General Social Survey.sav file, which is in the PASW directory.

  2. Choose Graphs

    Gallery tab
    Chart Builder.

    The Chart Builder dialog box appears, as shown in Figure 9-1. If a graph was generated previously, the display will be different, and you will need to click the Reset button to clear the Chart Builder display.

  3. Make certain the Gallery tab is selected.

  4. In the Choose From list, select Bar as the graph type.

    The fundamental types of bar charts appear in the gallery to the right of the list.

  5. Define the general shape of the bar graph to be drawn.

    You can do so in two ways. The simplest is to choose one member from the set of diagrams of bar graphs appearing immediately to the right of the list. For this exercise, select the diagram in the upper-left corner and drag it to the large chart preview panel at the top. Alternatively, you can click the Basic Elements tab (instead of the Gallery tab) and drag one image from each of the two displayed panels to the panel on top, which constructs the same diagram as the bar graph. Figure 9-2 shows the appearance of the window after the dragging is complete. The result is the same no matter which procedure you follow.

    Tip

    You can always back up and start over: At any time during the design of a graph, click the Reset button. Anything you dragged to the display panel is deleted, and you can start from scratch.

    The initial Chart Builder window with Bar chosen.

    Figure 9.1. The initial Chart Builder window with Bar chosen.

  6. Click Close to close the Element Properties window (see Figure 9-3).

    This window should have popped up when you dragged the graphic layout to the panel. This dialog box is not needed for this example, so you can close it. If it didn't appear but you'd like to see it, you can click the Element Properties button at any time.

  7. From the list on the left, select the variable with the label and name Highest Year of School Completed (Educ) and drag it to the Y-Axis label in the diagram.

  8. In similar fashion, select the variable with the label and name Region of the United States (region) and drag it to the X-Axis label in the diagram.

    The screen now looks like the one shown in Figure 9-4.

    The appearance of the new bar chart is defined.

    Figure 9.2. The appearance of the new bar chart is defined.

    Use the Element Properties window to modify chart elements.

    Figure 9.3. Use the Element Properties window to modify chart elements.

    Note

    The graphics display inside the Chart Builder window never represents your actual data, even after you insert variable names. This window simply displays a diagram that demonstrates the composition and appearance of the graph that will be produced.

    The diagram after assigning the X- and Y-axes.

    Figure 9.4. The diagram after assigning the X- and Y-axes.

  9. Click the OK button to produce the graph.

    A SPSS Viewer window appears, containing the graph shown in Figure 9-5. This graph is based on the actual data; it shows that the average number of years of education varied little from one part of the country to the next in this survey.

A bar chart produced from a data file and displayed by SPSS Viewer.

Figure 9.5. A bar chart produced from a data file and displayed by SPSS Viewer.

These steps demonstrate the simplest way possible of generating a chart. Most of the options available to you were left out of the example so it would demonstrate the simplicity of the basic process. The following sections describe the options.

Basic Elements tab

The example in the preceding section used the Gallery tab to select the type and appearance of the chart. Alternatively, you can click the Basic Elements tab in the Chart Builder dialog box and select one part of the chart from each of the two panels shown in Figure 9-6.

Choose the axes and elements to construct the graph you want.

Figure 9.6. Choose the axes and elements to construct the graph you want.

It's sort of like the menu in a Chinese restaurant — you choose one from column A and another from column B. You drag one image from each panel into the panel at the top, and they combine to construct a diagram of the graph you want.

The result is the same as you get from using the Gallery tab. The only difference is that you use the Basic Elements tab to build the graph from its components. Whether you use this technique or the Gallery depends on your conception of the graph you want to produce.

Groups/Point ID tab

Once you have selected the type and appearance of your chart through either the gallery or the Basic Elements tab, you can click the Groups/Point ID tab in the Chart Builder dialog box, which provides you with a group of options you can use to add another dimension to your graph.

In the example in Figure 9-7, I selected the Rows Panel Variable option, which generates a multifaceted graph. The new dimension adds a separate graph for the number of children in the family. A separate set of bars is drawn for those with no children, another set for those with one child, another for those with two children, and so on.

You can add dimensions to your graph.

Figure 9.7. You can add dimensions to your graph.

The Columns Panel Variable option enables you to add a variable along the other axis, thus adding another dimension. Adding variables and new dimensions this way is known as paneling, or faceting.

Clustering (gathering data into groups) can also be done along the X- or Y-axis if the variables are the type that will cluster (or bin) properly.

Titles and footnotes tab

Figure 9-8 shows the window you get when you click the Titles/Footnotes tab in the Chart Builder dialog box. Each option in the bottom panel places text at a different location on the graph. When you select an option, the Element Properties window appears so you can enter the text for the specified location.

Select the chart's text and its location.

Figure 9.8. Select the chart's text and its location.

Element Properties dialog box

You can use the Element Properties dialog box at any time during the design of a chart to set the properties of the individual elements in the chart. One mode of the dialog box is shown in one mode in Figure 9-3, and another, in Figure 9-9, changes every time you choose a different member from the list at its top.

Tip

The dialog box often pops up on its own when you add an item to the graph's definition. You can make it appear any time you want by clicking the Element Properties button in the Chart Builder dialog box.

Okay, the upcoming list of options is long, but four facts make them simple to use:

  • All options have reasonable defaults. You don't have to change any of them unless you want to.

  • You can always back up and change whatever settings you made. Nothing is permanent, so you can make changes until you've finished or run out of time and decide, "That's good enough."

  • Not all options appear at once. Only a few show up at a time. In fact, you'll probably never see some of the possible options.

    The options for an axis variable.

    Figure 9.9. The options for an axis variable.

  • All options become obvious when you see what they do. You don't have to memorize any of them, but you'll find they are easy to remember.

The following is a simple explanation of all the possible options that can appear in an Element Properties dialog box:

  • Edit Properties Of: This list, which appears at the top of the window, is used for selecting which element in the chart you want to edit. Each element has a type, and the type of the element you select determines the other options available in the window. The selected element is also highlighted in the diagram of the graph in some way.

  • X: When an element is selected and the X button to the right of the list becomes enabled, clicking the button removes the element from the list and from the graph.

  • Arrow: For charts with dual Y-axis variables, the arrow to the right in the list indicates which of the variables will be drawn on top of the other. You can click the arrows to change the drawing order.

  • Statistics: For certain elements, you can specify the statistics (that is, the type of value) to be displayed in the graph. For example, you can select Count and use simple numeric values. You can also select Sum, Median, Variance, Percentile, or any of up to 32 statistic types. Not all types of charts have that many options; the options that are available also depend on the types of variables you're using. For certain statistics options — such as Number in Range and Percentage Less Than — the Set Parameters button is activated; you have to click it to set the parameters controlling your choice.

  • Axis Label: You can change the text used to describe a variable. By default, the variable's label is used.

  • Automatic: If selected, the range of the selected axis is determined automatically to include all the values of the variable being displayed along that axis. This is the default.

  • Minimum/Maximum: You can replace the Automatic default values and choose the extreme values that determine the starting and ending points of an axis.

  • Origin: Specifies a point from which chart information is graphed. This option has different effects for different types of charts. (For example, choosing an origin value for a bar chart can cause bars to extend both up and down from a center line.)

  • Major Increment: The spacing that determines the placing of tick marks, along with numeric or textual labels, on an axis. The value of this option determines the interval of spacing when you also specify minimum and maximum values.

  • Scale Type: You have four different types of scale you can use along an axis:

    • Linear: A simple, ruler-like scale. This is the default.

    • Logarithmic (standard): Transforms the values into logarithmic values for display. You can also select a base for the logarithms.

    • Logarithmic (safe): Same as standard logarithms, except the formulas that calculate values can handle 0 and negative numbers.

    • Power: Raises the values to an exponential power. You can select an exponent other than the default value of 0.5 (which is the square root).

  • Sort By: You can select which characteristic of a variable will be used as the sort key. It can be one of the following three:

    • Label: Nominal variables are sorted by the names assigned to the values; you can choose whether to sort in ascending or descending order.

    • Value: Uses the numeric values for sorting. You can choose whether to sort in ascending or descending order.

    • Custom: Uses the order specified in the Order List.

  • Order List: The list of possible values is flanked by up and down arrows. You can change the sorting order by selecting a value and clicking an arrow to move the selection up or down. To remove a value from the produced chart, select its name in the list and click the X button; the value moves to the Excluded list. When you change the Order List, then Sort By switches automatically to Custom.

  • Excluded: Any value you want to exclude from the Order List appears in this list. To move a value back to the Order List (which also causes the value to reappear on the chart), select its name and click the arrow to the right of the list.

    Tip

    If a value (or a margin annotation representing a value) is unexpectedly missing from a graph based your selections, look in this Excluded list. You may have excluded too much.

  • Collapse: If you have a number of values that seldom occur, you can select this option to have them gathered into an "Other" category. You specify the percentage of the total number of occurrences to make it an "Other" value.

  • Error Bars: For Mean, Median, Count, and Percentage, confidence intervals are displayed. For Mean, you must choose whether the error bars will represent the confidence interval, a multiple of the standard error, or a multiple of the standard deviation.

  • Bar style: You can choose one of three possible appearances of the bars on a bar graph.

  • Categories: You can choose the order in which the values appear when they're placed along an axis. You can select ascending or descending order. If the variable is nominal, you can select the individual order and even specify values to be left out.

  • Small/Empty Categories: You can choose to include or exclude missing value information.

  • Display Normal Curve: For a histogram, you can choose to have a normal curve superimposed over the chart. The curve will use the same mean and standard deviation values as the histogram.

  • Stack Identical Values: For a chart that will appear as a dot plot (a pattern of plotted points), you can choose whether points at the same location should appear next to one another or one on top of the other (that is, with one point blotting out the one below it).

  • Display Vertical Drop Lines between Points: For a chart that will appear as a dot plot (a pattern of plotted points), any points with the same X-axis values show a vertical line joining them.

  • Plot Shape: For a dot plot, you can choose

    • Asymmetric: Stacks the points on the X-axis. This is the default.

    • Symmetric: Stacks the points centered around a line drawn horizontally across the center of the screen.

    • Flat: The same as Symmetric, except no line is drawn.

  • Interpolation: For line and area charts, the algorithm used to calculate how the line should be drawn between points:

    • Straight: Draws a line directly from one point to the next.

    • Step: Draws a horizontal line through each point; the ends of the horizontal lines are connected with vertical lines.

    • Jump: Draws a horizontal line through each point, but the ends of the lines are not connected.

    • Location: For Step and Jump interpolation; using this option adds an indicator at the actual point.

    • Interpolation through Missing Values: For Straight, Step, or Jump, this option draws lines through missing values. Otherwise the line shows a gap.

  • Anchor Bin: The starting value of the first bin. This option is available for histograms.

  • Bin Sizes: Sets the sizes of the bins when you're producing a histogram.

  • Angle: Rotates a pie chart by selecting the clock position at which the first value starts. You can also specify whether the values should be included clockwise or counterclockwise.

  • Display Axis: For a pie chart, you can choose to display the axis points on the outer rim.

Options

Clicking the Options button in the Chart Builder dialog box opens the Options dialog box, shown in Figure 9-10.

When you define the characteristics of a variable, you can specify that certain values be considered missing values. The options in the Break Variables area let you decide whether you would like those included or excluded from your chart. You can also specify how you would like summary statistics handled. (Missing values are discussed in Chapter 4, and the different types of summary data are described in Chapter 7.)

Templates are files that contain all or part of a chart definition. You can insert one or more names of template files into the list in this window, and SPSS will apply those template definitions as the default starting points for all charts you build. You create a template file from a finished chart displayed in SPSS Viewer. You find out more on making templates later in this chapter.

Tip

Templates come in handy only when you want to build lots of similar charts. You can use the Chart Size option to make the generated charts smaller or larger, as needed.

Options you can apply to a chart.

Figure 9.10. Options you can apply to a chart.

The Wrap Panels option determines how the panels are displayed when you have a number of them in a chart. SPSS is using the word panel to refer to the rectangular area in SPSS Viewer in which a chart is placed. Normally the panels shrink automatically to fit; if you select this option, however, they remain full-size and wrap to the next line.

Building Graphs the Fast Way

The charts you build by choosing Graphs

Building Graphs the Fast Way

First you select the variables you want to include, which causes the available kinds of charts (such as bar, dot, or line) to appear on-screen, as shown in Figure 9-11. Using the tabs at the top of the screen (Basic, Detailed, Titles, Options) you can choose screens that allow you to set the options. Be careful here; setting an option in one window may change the options that appear in another window. Be sure you know what you're after before you start. When you've set your preferred options, click the OK button, and the chart is generated.

The Interactive options for constructing a bar graph.

Figure 9.11. The Interactive options for constructing a bar graph.

If you get things balled up, it's easy to restart. The Reset button removes everything you've entered in all the tabbed windows and restores all the defaults.

The Help button provides some information about whichever list of options is displayed at the moment.

Note

The Paste button is for those who want to add to their graph definition in the most fundamental way possible. Inside SPSS, a graph is actually constructed by a command in the Syntax Command language. The steps you take to create a graph do nothing more than create the Command Syntax, which in turn creates the graph. The Paste button opens SPSS Syntax Editor with the Command Syntax in it, so you can edit the text of the command to produce the chart the way you want. (For more on using the Syntax language, see Chapters 14 and 15.)

Building Graphs the Old-Fashioned Way

The charts you build by choosing Graphs

Building Graphs the Old-Fashioned Way

The first selection you make is the type of chart to be produced (such as bar, dot, or line). As you proceed through the steps that define the graph, different windows appear, such as the one shown for bar graphs in Figure 9-12. Each time you finish with one window, you click the OK button and move to the next window in the series. When you finish the last one, the result appears.

A window for designing a bar chart using the Legacy method.

Figure 9.12. A window for designing a bar chart using the Legacy method.

The options presented to you in the Legacy method are not quite as complete as the ones in the other two methods. This arrangement makes it easy to produce simpler charts and graphs, but you must know what you're doing because you can't back up. When you've specified the values in a particular window and move on, the values stay that way until you've finished.

Editing a Graph

After you've built a chart and it's displayed in SPSS Viewer, you can still change it. Double-click the graph, and a copy of it appears in a new Chart Editor window, as shown in Figure 9-13.

A final chart presented for changes by Chart Editor.

Figure 9.13. A final chart presented for changes by Chart Editor.

Earlier in this chapter I mentioned that you could use templates to help define new charts in Chart Builder (see Figure 9-10). You can create a template file from Chart Editor by choosing File

A final chart presented for changes by Chart Editor.

Using Chart Editor, you can do a number of things with the chart. The options available are mostly the same ones you worked with when defining the original layout, so there are no big surprises.

Figure 9-14 is the same graph as Figure 9-13, but with the axes transposed (to make the bars grow horizontally), a fit line has been added, the overall size of the chart reduced, and a line has been added to emphasize a specific value.

The many menus of Chart Editor have option settings that you can use to try to make your chart demonstrate the data better. Fortunately, none of these selections are destructive — if you try something and don't like it, you can back your changes out and restore what you had before.

The final chart after a few edits by Chart Editor.

Figure 9.14. The final chart after a few edits by Chart Editor.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.80.100