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
2.1m questions
2.1m answers
60 comments
57.0k users