【问题标题】:Any substitute of gganimate. or solution to animated graphgganimate的任何替代品。或动画图的解决方案
【发布时间】:2017-07-31 13:11:58
【问题描述】:

我正在尝试使用 gganimate 为地图上的图表设置动画。但它不工作。是否有任何替代品。还是我在实施 gganimate 时犯了任何错误。如果可以为我的地图制作动画,请仔细阅读我的代码。

   setwd("E:\\earthquake-database")
dataset=read.csv("database.csv")

library(plyr)
library(dplyr)
library(ggmap)
library(ggplot2)
library(animation)

eq=read.csv("database.csv", stringsAsFactors = F)
names(eq)

eq = eq %>% 
  filter(Magnitude > 7)
eq$Date <-as.character(eq$Date)
list<-strsplit(eq$Date,"/")
eq_Date1<-ldply(list)
colnames(eq_Date1)<-c("Day","Month","Year")
eq_Date1

## Column bind with the main dataframe
eq<-cbind(eq,eq_Date1)
names(eq)
eq$Year<-as.numeric(eq$Year)

## Get the world map for plot and load the necessary package
world<-map_data("world")
world <- world[world$region != "Antarctica",]
names(world)


map<-ggplot()+geom_map(data=world,
                       map=world,aes(x=long,y=lat,
                                     map_id=region),color='#333300',fill='#663300')

p <- map + geom_point(data = eq, aes(x = Longitude, y = Latitude, 
                                     frame = Year, 
                                     cumulative = TRUE,size=EQ$Magnitude), alpha = 0.3, 
                      size = 2.5,color="#FF0000")+
  geom_jitter(width = 0.1) +labs(title = "Earthquake above 7 point on richter scale")+theme_void()



library(gganimate) # its not working

devtools::install_github("dgrtwo/gganimate") # it is also not working
nter code here

【问题讨论】:

    标签: r rstudio


    【解决方案1】:

    我刚刚找到了答案 谢谢

        library(devtools)
    install.packages(“Rcpp”)
    devtools::install_github("dgrtwo/gganimate")
    library(gganimate)
    

    它对我有用

    【讨论】:

      猜你喜欢
      • 2016-10-16
      • 1970-01-01
      • 2014-08-31
      • 2011-04-13
      • 2016-10-24
      • 1970-01-01
      • 1970-01-01
      • 2016-06-04
      • 1970-01-01
      相关资源
      最近更新 更多