Suppose I have the following
y <- rnorm(10)
b <- as.factor(sample(1:4,10,replace=T))
qplot(1:10, y, shape=b)
How do I change the shapes that are used using ggplot2
?
Suppose I have the following
y <- rnorm(10)
b <- as.factor(sample(1:4,10,replace=T))
qplot(1:10, y, shape=b)
How do I change the shapes that are used using ggplot2
?
The ggplot way to do it would be to use scale_shape_manual
and provide the desired shapes in the values
argument:
qplot(1:10, y, shape=b) + scale_shape_manual(values = c(0, 5, 6, 15))
The shapes are the same as the usual 0-25 indexes: http://yusung.blogspot.com/2008/11/plot-symbols-in-r.html