[英]Funnel Chart in R
我们使用 R 脚本创建了一个漏斗图,但我们无法将背景颜色从白色更改为颜色#00355c
。
使用的代码:
library(plotly)
fig <- plot_ly()
fig <- fig %>%
add_trace(
type = "funnel",
y = c("Invoiced", "Cancelled", "Collected", "Write Off", "Out Standing"),
x = c(ZF_ZFO2CV001_OTC_002$`Net Invoiced (ABS)`,
ZF_ZFO2CV001_OTC_002$`Cancelled (Net Invoiced)`,
ZF_ZFO2CV001_OTC_002$`collected (ABS)`,
ZF_ZFO2CV001_OTC_002$`Write Off (ABS)`,
ZF_ZFO2CV001_OTC_002$`Outstanding Amount`))
fig <- fig %>%
layout(yaxis = list(categoryarray = c("Invoiced", "Cancelled", "Collected", "Write Off", "Out Standing")))
fig
期望将背景颜色从白色更改为#00355c
。
您需要在layout()
中分配plot_bgcolor
、 paper_bgcolor
或两者。
我已经使用灰色和您确定的颜色来显示哪个参数做了什么。 看看这个:
library(plotly)
(fig <- plot_ly(type = "funnel",
y = c("Invoiced", "Cancelled", "Collected", "Write Off", "Outstanding"),
x = c(1, 3, 5, 7, 8)) %>%
layout(yaxis = list(categoryarray = c("Invoiced", "Cancelled", "Collected",
"Write Off", "Outstanding")),
plot_bgcolor = "#00355c", paper_bgcolor = "gray"))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.