Univariate Enumerative Plots

Enumerative plots, in which all observations are shown, have the advantage of not losing any specific information--the values of the individual observations can be retrieved from the plot.  The disadvantage of such plots arises when there are a large number of observations--it may be difficult to get an overall view of the properties of a variable.  Enumerative plots do a fairly good job of displaying the location, dispersion and distribution of a variable, but may not allow a clear comparison of variables, one to another.

(Reminder—how to read files:  Starting out, the most reliable way to read a file is to download it, and then using the nested functions read.csv() and file.choose():

cities <- read.csv(file.choose())

browse to the file, and click on it.)

The plots:

Index Plot/Univariate Scatter Diagram 

Displays the values of a single variable for each observation using symbols, with values of the variable for each observation plotted relative to the observation number

# use large cities data [cities.csv]
attach(cities)
plot(Pop.2000)

(Note the use of the attach() function.  An individual variable's "full" name is the name of the dataframe concatentated with its "short" name, with a dollar sign in between, e.g. cities$Pop.2000.  The attach() function puts the data frame in the first search position and allows one to refer to a variable just by its short name (e.g. Pop.2000).

Y Zero High-Density Plot

Displays the values of a single variable plotted as thin vertical lines

plot(Pop.2000, type="h")

Other plot types

type = "l", "b", "o", "s", or "S"

Time Series Plots

When data are in some kind of order (as in time), index values contain some useful information.

# use Specmap O-18 data [specmap.csv]
attach(specmap)
plot(O18)
plot(O18, ylim=c(2.5,-2.5))   #  invert y-axis

Strip Plot (“univariate scatter diagram"

Displays the values of a single variable as symbols plotted along a line

stripchart(O18)
stripchart(O18, method="stack")   # stack points to reduce overlap

Dot Plot  / Dot Chart

The Cleveland dot plot displays the values of a single variable as symbols plotted along a line, with a separate line for each observation.

dotchart(Pop.2000, labels=City)

An alternative version of this plot, and the one most frequently used, can be constructed by sorting the rows of the data table.  Sorting can be tricky--it is easy to completely rearrange a data set by sorting one variable and not the others.  It is often better to leave the data unsorted, and to use an auxiliary variable (in this case index) to record the rank-order of the variable being plotted (in this case Pop.2000), and the explicit vector-element indexing of R to arrange the data in the right order:

index <- order(Pop.2000)
dotchart(Pop.2000[index], labels=City[index])

This example shows an example of indexing  or referring to specific values of a variable by specifying the subscripts of the observations involved (in square brackets [ ... ] ).

Once you're done with a data set, it's good to "detach" it to avoid conflict among variables from different data sets that might have the same name.

detach(specmap)
detach(cities)