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?
ggplot2
The ggplot way to do it would be to use scale_shape_manual and provide the desired shapes in the values argument:
scale_shape_manual
values
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
1.4m articles
1.4m replys
5 comments
57.0k users