The
dotchart command provides a dot plot, a simple representation of frequency. It is part of the graphics package.
As with dot plot, advantages include a graph you can quickly make by hand. Outliers are easy to identify, and you can gage clusters, gaps, and histogram-like shapes. Most notably, dot plots preserve the numeric value of each data point (something lost with a bar chart, for example). See
Dot plot (statistics) in Wikipedia.
It's use is limited to data sets of relatively few data points. Too many points and the graph becomes unreadable.
dotchart has 20 parameters, but the only one you must have is x -- a vector or matrix (table).
dotcart is a Variation on Bar Chart
After poking around with this a bit, I discover that
dotchart is specialized dot plot function. The R documentation lists this as Cleveland's Dot Plot. In Wikipedia,
I learn that a Cleveland Dot Plot is "…an alternative to the bar chart, in which dots are used to depict the quantitative values (e.g. counts) associated with categorical variables." These are supposed to be easier to read and interpret that bar charts.
R Example
This first example plots the numeric mass of a number of common animals.
> library(MASS) > dotchart(airmiles)
|
Passenger miles on US airlines between 1937 and 1960 |
This example shows just one dot per category. The airmiles dataset lists passenger miles on US airlines between 1937 and 1960. In the structure, though, the date years are represented as Time-Series [1:24], so there's no hard-wired column of years.
I was initially confused with dotchart, because the examples didn't show me how to label the dots. (The plot function ekes the years out automatically.) I found that to label the points in dotchart requires creation of another set of points be paired with the airmiles data). There are also dotchart2 and dotchart3 which may handle time series years more elegantly. So I'm going with just another example:
dotchart(mtcars$mpg,labels=row.names(mtcars),cex=.7,
main="Gas Milage for Car Models",
xlab="Miles Per Gallon")
|
MPG for Common Cars |
I think this version is easier to read than a
barchart, for sure. The
calibrate:textxy function allows you to do this.