簡體   English   中英

與背景顏色的小平面在Plotly

[英]Facets with background colour in Plotly

我正在嘗試繪制迷你圖的小倍數圖,以使每個迷你圖的背景根據變量(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中做一個“直方圖”,上面覆蓋着我的迷你圖,但我也不太清楚。

任何想法都表示贊賞。

geom_rect中尚不支持ggplotly

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM