ggplot2におけるsubset

subsetで抽出したデータごとのプロット。
plyrが必要。

library(ggplot2)
library(plyr)
ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) + geom_point(subset = .(Species == 
    "setosa"), color = "red") + geom_point(subset = .(Species == "virginica"), 
    color = "blue")

plot of chunk unnamed-chunk-1