plotrix (version 3.6-4)

ehplot: Engelmann-Hecker-Plot - EH-Plot

Description

This R function provides a convenient way to visualize the distribution of grouped numerical data.

Usage

ehplot(data, groups, intervals=50, offset=0.1, log=FALSE, median=TRUE, box=FALSE, boxborder="grey50", xlab="groups", ylab="values", col="black", add=FALSE, sort=TRUE, ...)

Arguments

data
Vector of numerical data.
groups
Vector of group names which should have the same length as data.
intervals
The data is splitted into a certain number of intervals. If data points are in the same interval they are drawn side-by-side.
offset
x-distance between two data points at the same interval.
log
Logarithmic display
median
To show the median of each group. NAs in data are not considered for calculating the medians.
box
To underlay a boxplot.
boxborder
The color of the boxplot if a boxplot is drawn.
xlab
x-axis label
ylab
y-axis label
col
vector of colors for the datapoints. (recycled as necessary).
add
add this plot to an existing one (i.e. do not call plot.new).
sort
normally, the groups are sorted by name. To keep the order as provided in the groups-vector, set this to FALSE
...
additional plot-parameters will be passed to the plot-function

Examples

Run this code
data(iris)
ehplot(iris$Sepal.Length, iris$Species, intervals=20, cex=1.8, pch=20)
ehplot(iris$Sepal.Width, iris$Species, intervals=20, box=TRUE, median=FALSE)
ehplot(iris$Petal.Length, iris$Species, pch=17, col="red", log=TRUE)
ehplot(iris$Petal.Length, iris$Species, offset=0.06, pch=as.numeric(iris$Species))

# Groups don't have to be presorted:
rnd <- sample(150)
plen <- iris$Petal.Length[rnd]
pwid <- abs(rnorm(150, 1.2))
spec <- iris$Species[rnd]
ehplot(plen, spec, pch=19, cex=pwid, col=rainbow(3, alpha=0.6)[as.numeric(spec)])

Run the code above in your browser using DataLab