【问题标题】:Facets with background colour in PlotlyPlotly 中具有背景颜色的构面
【发布时间】: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 中做一个“直方图”,上面覆盖着我的迷你图,但我也无法完全弄清楚。

感谢任何想法。

【问题讨论】:

    标签: r ggplot2 facet plotly


    【解决方案1】:

    ggplotly 尚不支持geom_rect

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-28
    • 1970-01-01
    • 2023-03-03
    • 1970-01-01
    • 2022-11-05
    • 1970-01-01
    • 1970-01-01
    • 2014-11-14
    相关资源
    最近更新 更多