【问题标题】:Plotly: how to increase width Y axis?Plotly:如何增加 Y 轴的宽度?
【发布时间】:2017-05-18 15:06:11
【问题描述】:

我想增加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')

【问题讨论】:

标签: r plot plotly


【解决方案1】:

很好地隐藏了这个...您可以在域下的 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 对象,其中包含所有设置。然后,搜索该对象可能有助于找到正确的设置。

【讨论】:

    猜你喜欢
    • 2021-03-10
    • 1970-01-01
    • 1970-01-01
    • 2019-09-06
    • 2020-12-15
    • 1970-01-01
    • 2020-07-19
    • 2022-07-06
    • 1970-01-01
    相关资源
    最近更新 更多