I'm trying to make a single plot out of the next two:
datos <- rnorm(100000)
datos <- data.frame(boot=datos)
ggplot(datos, aes(x=boot)) +
geom_histogram(aes(y=..density..),
colour="white",
fill="steelblue")+
geom_density(alpha=.2, fill="gold",col="gold",lwd=0.75) +
geom_vline(aes(xintercept = mean(datos$boot),color="Media"),
lwd=0.75)+
geom_vline(aes(xintercept = quantile(datos$boot,0.95)),
lwd=0.75,linetype="dashed")+
geom_hline(yintercept = 0,col="black",lwd=1)+
scale_color_manual(name = "Estadísticas",
values = c(Media = "red"))+
labs(title=latex2exp::TeX("Figura 1: Histograma De las $R^2_{adj}$ obtenidas por \\textit{bootstrap}"),
subtitle="Experimento realizado con 10,000 muestras independientes",
y="Densidad estimada", x=latex2exp::TeX("$R^2_{adj}$"))
And
datos <- rnorm(100000)
datos <- data.frame(boot=datos)
ggplot(datos, aes(x=boot)) +
geom_histogram(aes(y=..density..),
colour="white",
fill="steelblue")+
geom_density(alpha=.2, fill="gold",col="gold",lwd=0.75) +
geom_vline(aes(xintercept = mean(datos$boot)),
lwd=0.75)+
geom_vline(aes(xintercept = quantile(datos$boot,0.95),color="Normal"),
lwd=0.75,linetype="dashed")+
geom_hline(yintercept = 0,col="black",lwd=1)+
scale_color_manual(name = "Intervalos",
values = c(Normal = "green"))+
labs(title=latex2exp::TeX("Figura 1: Histograma De las $R^2_{adj}$ obtenidas por \\textit{bootstrap}"),
subtitle="Experimento realizado con 10,000 muestras independientes",
y="Densidad estimada", x=latex2exp::TeX("$R^2_{adj}$"))
What I want to do is a single plot in which I have two groups of line legends "Intervalos" and "Estadísticas". This is what I need: