Reputation: 4949
Hi suppose I have the following dataframe and want to generate the plot below. I can plot this simply, however, for the missing value: s2,b1 is there a way I can add a circle with a different color? basically I want to fill in a grey point for anywhere in the plot that does not have a black. If there say 5 samples this can get complicated fast.
temp = data.frame ( sample=c("s1","s1","s2"), drug=c("a","b","a"))
ggplot(data=temp, aes(x=sample, y= factor ( drug) ) )+
geom_point(size=20)
Upvotes: 2
Views: 2012
Reputation: 26343
You could try table
ggplot(data=as.data.frame(table(temp)), aes(x=sample, y= factor ( drug) ) )+
geom_point(aes(color=as.factor(Freq)), size = 20) +
scale_color_manual(values = c("grey70", "black"))
Upvotes: 2