Skip to content

How to plot a matrix of intervals

2 messages · Stacey Burrows, Hadley Wickham

#
On Mon, Sep 15, 2008 at 5:06 PM, Stacey Burrows <stacey.burrows at yahoo.ca> wrote:
Here's one approach:

install.packages("ggplot2")

library(reshape)
am <- melt(aberations)
am$value[am$value == 0] <- NA

library(ggplot2)
qplot(X2 * value, X1, data=am) + geom_path()

Converting the zeros to missing values means that when we multiply the
x position by value, it will be missing if the value is 0, causing
breaks in the lines and the absences of points.  I think this same
basic approach will work for base graphics and lattice graphics too.

Hadley