使用宽度/高度在ggplotly中调整大小的动态高度/宽度= 100%

发布于 2025-02-11 00:07:21 字数 729 浏览 0 评论 0原文

我想通过允许动态高度/宽度来创建一个用ggplotly()r中创建一个图,以便在HTML中看起来像这样的东西:

< Div ID =“ HTMLWIDGET-7C8A8E27B8CE66400314”样式=“宽度:100%;高度:100%;” class =“ plotly html-widget”></div>

with:width/height = 100%

但是,这似乎不允许在ggplotly中( ): 此

ggplotly(p,size =“ 100%”,高度=“ 100%”)会出现错误。

当使用rshiny plotlyoutput(例如 https://community.plotly.com/t/plotly-shiny-reactive-height-height-height-of-plots/1503/4 )。

有没有办法从ggplotly()做到这一点?

多谢!

I would like to create a plot with ggplotly() in R by allowing dynamic height/width so that it will look something like this in the html:

<div id="htmlwidget-7c8a8e27b8ce66400314" style="width:100%;height:100%;" class="plotly html-widget"></div>

with: width/height=100%

However, this doesn't seem to be allowed in ggplotly():
This

ggplotly(p, size=“100%”, height=“100%”) will throw an error.

It looks like this is possible when using RShiny plotlyOutput (e.g. https://community.plotly.com/t/plotly-shiny-reactive-height-of-plots/1503/4).

Is there a way to do that from ggplotly() ?

Thanks a lot!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文