Reputation: 841
I have the following code
TRP_C<-100/(100+650)
FPR_C<-200/(200+650)
C<-data.frame(TPR=TRP_C,FPR=FPR_C)
TRP_D<-120/(120+30)
FPR_D<-350/(350+500)
D<-data.frame(TPR=TRP_D,FPR=FPR_D)
ggplot(NULL, aes(x=FPR, y=TPR)) +
geom_point(data=C,shape=1,aes(fill="A"),size=4,color="red")+
geom_point(data=D,shape=1,aes(fill="B"),size=4,color="green")
The problem is it gives me a ggplot which the points are not clear on it at all. I think, if i can make the points filled then it would be more clear in the diagram.
So, how can i make the legend ,and points filled?
Upvotes: 1
Views: 1824
Reputation: 2884
Use shape
(insert value from 21-25) inside geom_point()
and scale_fill_manual
for colors.
So your code looks like this
ggplot(NULL, aes(x=FPR, y=TPR)) +
geom_point(data=C,shape=21,aes(fill="A"),size=4) +
geom_point(data=D,shape=21,aes(fill="B"),size=4) +
scale_fill_manual(values=c("red", "green"))
And output
Upvotes: 2