r - plotly :如何增加宽度 Y 轴?

标签 r plot plotly

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

相关文章:

r - 设置绘图热图的 x 和 y 范围

r - R 中 seq() 中缺少最后一个序列

r - 在 shapefile 中保存 ggplot2 coord_map() 图表

iphone - 如何创建比 Core Plot 生成的图表更好看的图表?

r - 如何在R中的同一个折线图上绘制多个柱形图?

node.js - 如何使用plot.ly向现有图表添加新数据

python - 创建一个 Plotly 按钮以在 ScatterPlot 中隐藏/显示数据点

r - 如何从 shapefile 传单 R 访问多边形信息

r - 使用R中的distm()计算数据帧中两个GPS位置之间的距离

python - 如何将多个 Seaborn 绘图保存到单个 pdf 文件中