简体   繁体   English

RStudio Viewer不自动刷新 plotly重复

[英]RStudio Viewer does not refresh automatically plotly plots

I have two computers, each with Windows 10, R 4.2.2 and the last RStudio version.我有两台电脑,每台都有 Windows 10、R 4.2.2 和最后一个 RStudio 版本。

On my home computer, the Viewer pane automatically refreshes when I adjust its size.在我的家用计算机上,当我调整其大小时,查看器窗格会自动刷新。 This is the normal/expected behavior.这是正常/预期的行为。

On my professional laptop, the Viewer does not refresh.在我的专业笔记本电脑上,查看器不会刷新。 This is annoying because I am using Plotly to show graphs in the Viewer pane, and the graph parameters (width of the bars, placement of the legend...) should be responsive to the pane's size.这很烦人,因为我使用 Plotly 在查看器窗格中显示图形,并且图形参数(条的宽度、图例的位置...)应该响应窗格的大小。

To reproduce my bug, one needs to load plotly and run plot_ly(x = c(1), y = "Test", type = 'bar') .要重现我的错误,需要加载plotly并运行plot_ly(x = c(1), y = "Test", type = 'bar') Then, change the Viewer width or height, and observe that the plot does not change.然后,更改 Viewer 的宽度或高度,观察 plot 没有变化。 Clicking on the "Refresh viewer" icon on the top-right of the pane correctly adjusts the plot, but it should be done automatically when adjusting the pane, not manually.单击窗格右上角的“刷新查看器”图标可正确调整 plot,但应在调整窗格时自动完成,而不是手动完成。

I am not sure how to exactly reproduce the bug though, since I have it only in one computer and both seem to have the same configuration.不过,我不确定如何准确地重现该错误,因为我只在一台计算机上有它,而且两台计算机似乎都具有相同的配置。

Something happened to me before.我之前发生过一件事。 If the packages is updated for your type of computer, try these two options:如果软件包针对您的计算机类型进行了更新,请尝试以下两个选项:

  1. Delete the package and re-install it!把package删掉,重新安装! You can do it with remove.packages("package_name") function. And then install it again.您可以使用remove.packages("package_name") function 来完成。然后重新安装。 (Check if are other related packages to the main one, and do the same with them). (检查其他相关包是否与主要包相关,并对它们执行相同操作)。 It just takes a few seconds to do the whole process.完成整个过程只需要几秒钟。
  2. If that does not work, uninstall R-Studio/Posit and install it again to clean the package relationships.如果这不起作用,请卸载 R-Studio/Posit 并重新安装以清除 package 关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM