library(plotly)
对于这些数据:
exDT2 <- structure(list(outflow = c(-150, -195, -200, -200, -200, -200,
-250, -250, -250, -250, -255, -300, -300, -300, -300, -300, -305,
-305, -350, -350, -400, -400, -435, -450, -450, -450, -450, -450,
-455, -455, -464, -470, -470, -500, -500, -500, -500, -500, -500,
-5000)), .Names = "outflow", row.names = c(NA, -40L), class = c("data.table",
"data.frame"))
plot_ly(exDT2, x = ~-outflow, type = "histogram") %>% layout(xaxis = list(title = "Title", type = "log"))
plot_ly(exDT2, x = ~log(-outflow), type = "histogram") %>% layout(xaxis = list(title = "Title"))
也就是说,我希望这些容器的宽度呈指数增长,但是使用对数轴(使得容器看起来宽度相同),并且使用有用的轴标签,而不是仅显示log-dollars < / p>
答案 0 :(得分:0)
我不知道是否可以plotly
完成此操作,但如果您对ggplot2
和ggplotly
开放,也许您可以尝试:
ggplot(exDT2, aes(-outflow)) +
geom_histogram(binwidth = 0.2, fill="blue") +
scale_x_log10(breaks=c(100, 200,500,1000, 5000)) + theme_bw()
ggplotly()
这就是你想要的吗?