-3

我有以下 2 个字符向量,这可能是一种有意义的绘制值的方式

Observed_Value          Simulated_Value

   IP                      BP
   SP                      IP
   BP                      SP
   IP                      IP
4

1 回答 1

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()

在此处输入图像描述

于 2013-05-03T17:58:11.740 回答