我希望使用geom_point
为Merge2.m$variable
中的点制作颜色。我该怎么做呢?请参阅下面的示例(不起作用):
ggplot(Merge2.m, aes(x=revDown, y=Term2, color=variable))+
theme_bw(12) +
geom_point(aes(color=factor(variable)), size=7, colour="black") +
labs(title="KEGG (Targets for up-regulated miRNAs)", y="KEGG", x="log2 inverted Pvalue")
> head(Merge2.m)
Term variable value revDown Term2
1 Acute myeloid leukemia PValDown 3.490840e-05 14.806066 Acute myeloid leukemia
2 Adherens junction PValDown 1.205063e-02 6.374748 Adherens junction
3 Bacterial invasion of epithelial cells PValDown 2.016157e-05 15.598032 Bacterial invasion of epithelial cells
4 Chemokine signaling pathway PValDown 1.101506e-02 6.504379 Chemokine signaling pathway
5 Chronic myeloid leukemia PValDown 3.964774e-06 17.944330 Chronic myeloid leukemia
6 Circadian rhythm - mammal PValDown 1.672252e-02 5.902064 Circadian rhythm - mammal
答案 0 :(得分:2)
删除colour = "black"
。您甚至可以简单地使用geom_point()
而不使用任何参数,因为您已经声明了所需的映射。
这是你做的:
ggplot(mtcars, aes(mpg, cyl, color = factor(cyl))) + geom_point(color = "black")
以下是需要做的事情:
ggplot(mtcars, aes(mpg, cyl, color = factor(cyl))) + geom_point()