【发布时间】:2015-04-13 14:52:05
【问题描述】:
我正在尝试绘制迷你图的小倍数图,以便每个迷你图的背景根据变量 (var4) 着色。我可以用 R 中的 ggplot 做到这一点,但它不能很好地转换为 Plotly。
ggplot(data, aes(x=var1, y=var2, group=var3, text=var3)) +
geom_rect(data = data, aes(xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf, fill = var4), alpha = 0.4) +
geom_line() +
scale_fill_gradient2(low = "red", mid = "white", high = "red", midpoint = 0, space = "rgb", na.value = "grey50", guide = "colourbar") +
facet_wrap(~ var3, ncol = 44, scales = "fixed")
我考虑过可能在 Plotly 中做一个“直方图”,上面覆盖着我的迷你图,但我也无法完全弄清楚。
感谢任何想法。
【问题讨论】: