1
爲什麼顏色與我輸入scale_colour_manual的顏色不一樣?爲什麼ggplot geom_tile不尊重我的顏色首選項
這裏的數據和代碼示例:
temp <- dput(head(binaryHeatMapPlotData))
structure(list(Structure = c("1A00", "1A01", "1A02", "1A0U",
"1A0Z", "1A1M"), method = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("iPAC4D",
"iPAC3D", "graphPAC4D", "graphPAC3D", "spacePAC4D", "spacePAC3D"
), class = "factor"), value = structure(c(3L, 3L, 2L, 3L, 3L,
2L), .Label = c("-1", "0", "1"), class = "factor")), .Names = c("Structure",
"method", "value"), row.names = c(NA, 6L), class = "data.frame")
binaryHeatMapPlot <- ggplot(temp, aes(y=as.factor(Structure),x=method, fill = value))+
scale_colour_manual(values = c("-1" = "white", "0" = "green", "1" = "blue"))+
geom_tile() +
ggtitle("Methodology Vs Cluster Detection By Structure")+
xlab("Method")+ylab("Structure")