我有以下两个字符向量,这可能是一种有意义的绘制值的方法
Observed_Value Simulated_Value
IP BP
SP IP
BP SP
IP IP
答案 0 :(得分:3)
好吧,也许您对热图感兴趣,热图会显示特定组合出现的频率:
library("plyr")
library("ggplot2")
df <- data.frame(
Observed = sample(rep( c("IP", "SP", "BP"), 100 )),
Simulated = sample(rep( c("IP", "SP", "BP"), 100 ))
)
counts <- ddply( df, c("Observed", "Simulated"), nrow )
names(counts)[3] <- "sum"
ggplot( counts, aes( x = Observed, y = Simulated, fill = sum ) ) + geom_tile()