My question is about presentation as the following code
My partner did it with python and the bars were more and the graph was higher without adjusting as I have done here it is possible to do the same in R
Mine doesn't look anything like how can I do that aesthetic I've tried scales even without adjusting the bins and binwith but still can't get the consistency they want
My code:
library(dplyr)
library(ggplot2)
m1<-as.data.frame(replicate(100, rnorm(49,2,3)))
mm1<-m1 %>% summarise_if(is.numeric, mean) #calcula la media del dataframe
rownames(mm1)="medias" #cambia el nombre de 1 por "medias"
mm1<-t(mm1) #transpone el dataframe
mm1<-as.data.frame(mm1) #lo convierte en un dataframe
h0<-ggplot(mm1,mapping = aes(x=medias)) #ingresa los datos para graficar
h1<-h0+geom_histogram(fill="aquamarine4",aes(y=2*(..density..)/sum(..density..)),binwidth =0.45 ,color="white")
h2<-h1+stat_function(mapping = aes(colour = "N(2,3/7)"),fun = dnorm,args = list(mean = 2,sd = 3/7))
h3<-h2+stat_function(mapping = aes(colour = "N(2,3"),fun = dnorm,args = list(mean = 2,sd = 3))
h4<-h3 +labs(x = "Medias", y= "Escala",title = "Grafico para muestras tamaño 49")
h4