-1
我想使用gganimate在地圖上設置動畫。但它不起作用。 Isa有任何替代品。或者我在執行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