Plotly:如何增加Y轴的宽度?

时间:2017-05-18 15:06:11

标签: r plot plotly

我想增加plotly水平条形图的Y轴宽度。现在,由于y轴太窄,文字会下降。

你可以在Plotly的examples页面上看到相同的情况,其中的类别很简单,不易阅读。

我找不到增加宽度的方法。非常感谢帮助!

示例代码:

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')

1 个答案:

答案 0 :(得分:1)

Plotly非常好地隐藏了......你可以在域下的xaxis布局中更改它。

以下内容可行:

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对象。然后,搜索该对象可能有助于找到正确的设置。

相关问题