我想要绘制在R.使用GGPLOT2散点图我有数据为csv格式如下突出显示特定的点在GGPLOT2
A B
-4.051587034 -2.388276692
-4.389339837 -3.742321425
-4.047207557 -3.460923901
-4.458420756 -2.462180905
-2.12090412 -2.251811973
我想高光两种特定点与对应-2.462180905和-3.742321425并以不同的颜色绘制。这应该与情节中的默认颜色不同。我试过下面的代码
library(ggplot2)
library(reshape2)
library(methods)
library(RSvgDevice)
Data<-read.csv("table.csv",header=TRUE,sep=",")
data1<-Data[,-3]
plot2<-ggplot(data1,aes(x = A, y = B)) + geom_point(aes(size=2,color=ifelse(y=-2.462180905,'red')))
graph<-plot2 + theme_bw()+opts(axis.line = theme_segment(colour = "black"),panel.grid.major=theme_blank(),panel.grid.minor=theme_blank(),panel.border = theme_blank())
ggsave(graph,file="figure.svg",height=6,width=7)
它不工作,我想要的方式。它以相同的颜色给所有的点。任何人都可以帮忙吗?