How to plot a `fevd` object using `ggplot2` in R?

2019-07-11 06:48发布

问题:

I am now doing extreme value analysis using extRemes package and I want to plot the return level for my results. I find that the default plot function in the package is not good, for example, I can not set line color, x label, and title. I wonder if we can do this in ggplot2?

library(extRemes)
library(xts)
library(ismev)
library(ggplot2)

data(rain)
precipitation <- rain
Daily <- seq(as.Date('1914-01-01'),as.Date('1961-12-30'),by = 1)
precipitation_xts <- xts(precipitation,Daily)
ams <- apply.yearly(precipitation_xts, FUN=max)
ams_df <- fortify(ams)
colnames(ams_df)[1] <- "Date"

mle <- fevd(x=ams, data=ams_df, location.fun=~Date, method = "MLE", type="GEV")
plot(x=mle, type="rl",rperiods=c(5,50,100))
标签: r plot ggplot2