0
我有一個數據框,其中有兩個不同的數據組的Recall值。我使用下面的代碼製作了密度圖,但我對它的外觀感到困惑。對於一個組(在這種情況下爲GE),召回非常高(始終爲1),在圖中我預計在x軸= 1時尖峯和相對較高的峯值(wrt Epi組),而在輸出中不是這種情況圖表(見附圖)。如何在ggplot2中獲得正確的「densityplot」?
命令我使用:
ggplot(epiGE, aes(x=Rec)) + geom_density(aes(group=Class, colour=Class, fill=Class), alpha=0.3) + theme(axis.title.x=element_blank(), axis.title.y=element_blank())
我也曾嘗試GGPLOT2直方圖,但有作爲在x軸= 1我不明白GE
組的右側分佈,作爲barplot顯示與GE
組相比,Epi
組中Recall=1
的值更多。
ggplot(epiGE, aes(x=Rec)) + geom_histogram(aes(group=Class, colour=Class, fill=Class), alpha=0.3) + theme(axis.title.x=element_blank(), axis.title.y=element_blank())
有人可以請指導我什麼,我做錯了什麼?謝謝。
這裏是我的數據dput:
> dput(epiGE)
structure(list(Class = structure(c(1L, 2L, 1L, 2L, 1L, 2L, 1L,
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L), .Label = c("Epi", "GE"), class = "factor"),
Rec = c(1, 1, 0.928571428571429, 1, 1, 1, 0.625, 1, 0.935897435897436,
1, 0.911764705882353, 1, 0.790697674418605, 1, 0.891891891891892,
1, 1, 1, 0.98019801980198, 1, 0.949367088607595, 1, 0.877551020408163,
1, 0.944444444444444, 1, 1, 1, 0.955445544554455, 1, 0.5,
1, 0.170731707317073, 1, 0.513513513513513, 1, 0, 1, 0.9,
1, 0.875, 1, 0.884615384615385, 1, 0.5, 1, 0.9, 1)), .Names = c("Class",
"Rec"), class = "data.frame", row.names = c(NA, -48L))
謝謝您抽空試試。我已經嘗試過這個參數,但是如果你看到了這個圖,那麼紅色峯值(代表Epi組)就會高於綠色峯值(代表GE組),因爲Epi類具有更多的Recall = 1數據點類,這裏不是這種情況(如果你看到兩個類的召回值)。 – Newbie
只有7或8個屬於Epi類的值,其回調範圍在0.8到1之間,而GE類中的所有值都具有Recall = 1,因此在這種情況下表示GE值的峯值高度應該高於代表Epi值的峯值高度(在區域0.9 - 1)。但是我們在情節中看到的是與之相反的。 – Newbie
'adjust = 1/50'如何?我覺得密度陰謀可能不是最適合實現你想要的陰謀。 – www