Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 动画条形图_R_Plotly - Fatal编程技术网

R 动画条形图

R 动画条形图,r,plotly,R,Plotly,我正在尝试使用ggplotly制作一个动画条形图或直方图。当我运行下面的代码时,我得到“Error in-data$group:一元运算符的参数无效”。但是,当我使用geom_point()而不是geom_bar(stat=“identity”)时,我没有得到任何错误。如何将其作为条形图或直方图使用 library(dplyr) library(plotly) plot <- mtcars %>% ggplot(aes(x = mpg, y = cyl, frame = hp)

我正在尝试使用ggplotly制作一个动画条形图或直方图。当我运行下面的代码时,我得到“Error in-data$group:一元运算符的参数无效”。但是,当我使用geom_point()而不是geom_bar(stat=“identity”)时,我没有得到任何错误。如何将其作为条形图或直方图使用

library(dplyr)
library(plotly)

plot <- mtcars %>%
  ggplot(aes(x = mpg, y = cyl, frame = hp)) +
  geom_bar(stat = "identity")

ggplotly(plot)
库(dplyr)
图书馆(绘本)
地块%
ggplot(aes(x=mpg,y=cyl,frame=hp))+
几何图形栏(stat=“identity”)
ggplotly(绘图)

可能没有太大帮助,但您上面的代码对我很有用。geom_point或geom_bar都很好。我使用的是R 3.1.1Plot也对我有用。更新
R
。我使用的是ggplot2的开发版本,现在我已经切换回了,我可以制作条形图。我有相同的错误,与最新版本的软件包相同。这里的错误-R版本3.6.0、ggplot2 3.2.0和plotly 4.9.0