# Distribution plot
library(ggplot2)
library(cowplot)

pase_hist<-ggplot(data=dta, aes(pase_0)) + 
  geom_histogram(binwidth = 10, aes(y =..density..), 
                 col="orange", 
                 fill="orange", 
                 alpha=.2) + 
  geom_density(col="tomato") + 
  geom_vline(xintercept=median(dta$pase_0),col="navy") +
  scale_x_continuous(limits=c(0,600) ,breaks=seq(0,600,by=50)) +
  labs(title="Baseline PASE distribution", x="PASE score", y="Count") +
  theme(axis.title.x=element_blank(),
        axis.text.x=element_blank(),
        axis.ticks.x=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank()
  )

pase_box<-ggplot(data=dta, aes(pase_0,y=1)) + 
  geom_boxplot(col="olivedrab", 
               fill="olivedrab", 
               alpha=.2) +
  geom_jitter(col="maroon", alpha=0.3) +
  scale_x_continuous(limits=c(0,600) , breaks=seq(0,600,by=50)) +
  labs(title=NULL, x="PASE score", y="Count") +
  theme(axis.text.y=element_blank(),
        axis.ticks.y=element_blank()
  )

pg<-cowplot::plot_grid(pase_hist, pase_box, align = "v", ncol = 1, rel_heights = c(0.7, 0.3))
