我想做一个GGPLOT2散点图
scores <- data.frame( SampleID = rep(LETTERS[1:3], 5), PC1 = rnorm(15), PC2 = rnorm(15) )
library( ggplot2 )
ggplot( scores, aes( x = PC1, y = PC2, colour = SampleID ) ) +
geom_point()
这个代码渐变中的颜色数据点,使thez往往不能真正区分。 我看到了
http://docs.ggplot2.org/current/geom_point.html
使用
geom_point(aes(colour = factor(cyl)))
着色但如果我进入
ggplot( scores, aes( x = PC1, y = PC2, colour = SampleID ) ) +
geom_point(aes(colour = factor(cyl)))
我得到一个错误信息
in factor(cyl) : object 'cyl' not found
有人可以告诉我怎么可以用或者不渐变颜色或不同颜色的符号的散点图?