I'm fitting data with traditional distributions. I am using qqcomp to plot my fitted distributions in a qqplot. I want to add to this plot also the data qqplot.
I already tried to add them the usual ggplot() way with + getting the message:
q+p Error: Don't know how to add p to a plot
Let's say:
library(ggplot2)
library(fitdistrplus)
z=rnorm(1000,5,1)+runif(1000,1,2)
fit.w=fitdist(z, "weibull")
fit.ln=fitdist(z, "lnorm")
fit.gam=fitdist(z,"gamma")
fitsc=list(fit.w, fit.ln,fit.gam)
###Comparison of fitted distributions
q=qqcomp (fitsc, legendtext = plot.legend,plotstyle = "ggplot")
print(q)
###QQplot of the data
z=dataframe(z)
p=ggplot(z,aes(sample=z))+stat_qq()
print(p)
I want to combine the plots q and p into one. I know qqcomp with plotstyle= "ggplot" creates a ggplot object, so I guess there is a way to combine these two plots. Thank you for your help.