我想增加 plotly
水平条形图的 Y 轴宽度。现在,由于 y 轴太窄,文本不在 plotly 中。
您可以在 examples 上看到同样的情况发生Plotly 页面,类别简单,可读性差。
我找不到增加宽度的方法。非常感谢您的帮助!
示例代码:
library(plotly)
p <- plot_ly(x = c(20, 14, 23),
y = c('long string which is not readable',
'orangutans (not readable)',
'monkeys'),
type = 'bar',
orientation = 'h')
最佳答案
Plotly 很好地隐藏了这一点......您可以在域下的 x 轴布局中更改它。
以下将起作用:
ax <- list(
domain = list(0.2, 1)
)
p <- plot_ly(x = c(20, 14, 23),
y = c('long string which is not readable',
'orangutans (not readable)',
'monkeys'),
type = 'bar',
orientation = 'h') %>%
layout(xaxis = ax)
一般提示:Plotly 有一个 online editor ,您可以在其中导出包含所有设置的 JSON 对象。然后,搜索该对象可能有助于找到正确的设置。
关于r - plotly :如何增加宽度 Y 轴?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44051460/