在 plotly.r 中启用自动缩放 [英] Enable autoscale in plotly.r

查看:69
本文介绍了在 plotly.r 中启用自动缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 flexdashboard 中,我使用了plotly"库来绘制图形.当数据在那时刷新时,条形尺寸会减小.当时当我点击自动缩放"选项时,它工作正常.我的问题是我们可以通过 plotly.r 代码中的任何选项自动启用自动缩放吗?

In my flexdashboard I used "plotly" library to plot the graph. when the data is refreshing at that time the bar size get reduced. At that time when I clicked on "autoscale" option then it is working fine. My question is can we enable autoscale automatically by any option in plotly.r code ?

推荐答案

尝试在 layout 选项中为 x 轴和 y 轴设置 autorange = TRUE.

Try setting autorange = TRUE for both the x- and y-axis in the layout option.

这为我解决了这个问题.

This solved the issue for me.

示例:

plot_ly(x, y, type = "bar") %>%
  layout(xaxis = list(autorange = TRUE),
         yaxis = list(autorange = TRUE))

对于 R 中的其他绘图轴修改,请查看此页面.

For other plotly axes modifications in R check this page.

这篇关于在 plotly.r 中启用自动缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆