我想要一個動態的「點隧道」,即在點附近繪製較暗的灰色區域。 我認爲線程ggplot legends - change labels, order and title的偉大答案是基於線程的dtt
中定義的實驗值。 代碼,這使得圖2中的點周圍的矩形暗灰色區域。1如何在R ggplot方面有動態點隧道?
molten <- structure(list(Vars = structure(c(1L, 2L, 1L, 2L, 1L, 2L), class = "factor", .Label = c("V1", "V2")), variable = structure(c(1L, 1L, 2L, 2L, 3L, 3L), class = "factor", .Label = c("REM", "Kevyt", "Syva")), value = c(160, 150, 380, 420, 110, 180)), .Names = c("Vars", "variable", "value"), row.names = c(NA, -6L), class = c("data.table", "data.frame"))
library(ggplot2)
# https://stackoverflow.com/a/12075912/54964
ggplot(molten, aes(x = Vars, y = value, group = variable, colour = variable, ymin = 100, ymax = 450)) +
geom_ribbon(alpha=0.2, colour=NA)+
geom_line() +
geom_point() +
facet_wrap(~variable)
圖1個輸出具有離散矩形點隧穿, 圖從thread
預期輸出:動態點隧道,即在圖2中的點周圍繪製較深的灰色區域,但是單獨跨越每個方面
R:3.4.0(反向移植)
OS:Debian的8.7
我不能從這個告訴你在找什麼,我認爲你必須更具體地說明正確的結果應該是什麼樣子。 – joran
你的意思是你想要一個灰色的矩形,跨越'範圍(x)'和'範圍(y)'給定面內的點? – eipi10