2012-11-02 89 views
0

我正在尋找一種繪製我的數據的方式。假設你有許多產生排序列表的算法,以及將列表中的每個項目標識爲真或假的分類器。我怎麼能產生使對方身邊每個算法圖表,每個等級都有自己的正方形堆疊如下:顯示真/假肯定的R圖

 __ __ 
3 |TP| |FP| 
    |__| |__| 
2 |FP| |TP| 
    |__| |__| 
1 |TP| |TP| 
    |__| |__| 
     a b 

凡TP可以是綠色和FP可以被染成紅色的例子。

+0

也許花葉陰謀[(LINK)(http://www.statmethods.net/advgraphs/mosaic.html) –

+0

嗨@Robert,你可能想要檢查解決方案是否解決您的問題並接受最好的解決方案 – HAVB

回答

0

可以與基礎R很容易地完成,使用heatmap()功能。

試試這個:

# Dataframe with TRUE/FALSE items 
mydf <- data.frame(a = c(T, F, T), b = c(T, T,F)) 

# Transform booleans into 1s and 0s, and plot heatmap 
heatmap(apply(mydf, 2, as.integer), 
     col = c("red", "lightgreen"), 
     xlab = "Algorithm", 
     ylab = "Item", 
     main = "False positives in red", 
     Rowv = NA, 
     Colv = NA, 
     scale = "column") 

True/False heatmap plot generated with R