Dot Charts
Standard version
Often it will be advisable to sort data first via mydata <- mydata[order(mydata$var-to-be-sorted-by),]
.
Now a simple dot chart can be produced by
dotchart(mydata$varname, labels=mydata$varname2, cex=.7, main="Title-for-chart", xlab="Label-for-x-axis")
Note that cex = ...
refers to the size of the symbols (relative to the default). It will influence both the dots and the labels.
If mydata
has row names (as will typically be the case) and these are to serve as labels, you will write:
dotchart(mydata$varname, labels=row.names(mydata), cex=.7, main="Title-for-chart", xlab="Label-for-x-axis")
Lattice version
The lattice
package contains procedure dotplot
, which may be outlined in more detail at a later stage.
© W. Ludwig-Mayerhofer, R Guide | Last update: 28 Dec 2016