dd<- read.csv("u_sensory.csv")

dd$time <- as.factor(dd$time)
library(ggplot2)
library(patchwork)


p1 <- ggplot(dd,aes(x=time,y=percent, fill=group)) +geom_col(position="dodge")+
   labs(title="Ulna sensory",x="Time after local anesthetic injection(min)", y= "Proportion of patients with sensory block (%)")+
  geom_text(aes(label = (count)),position = position_dodge(0.9),vjust = 1.5,hjust = 0.5)+
  geom_text(aes(label = round(percent,1)),position = position_dodge(0.9),vjust = -0.5,hjust = 0.5)+
  theme_bw()+
  theme(legend.position = c(.15, .9))+
  annotate("text", x = 3, y = 80, label = "*", size = 10) 


p2 <- ggplot(dd,aes(x=time,y=percent_m, fill=group)) +geom_col(position="dodge")+
  labs(title="Ulna motor",x="Time after local anesthetic injection(min)", y= "Proportion of patients with motor block (%)")+
  geom_text(aes(label = (count_m)),position = position_dodge(0.9),vjust = 1.5,hjust = 0.5)+
  geom_text(aes(label = round(percent_m,1)),position = position_dodge(0.9),vjust = -0.5,hjust = 0.5)+
  theme_bw()+
  theme(legend.position = c(.15, .9))+
  annotate("text", x = 2, y = 50, label = "*", size = 10) +
  annotate("text", x = 3, y = 90, label = "*", size = 10) 


p3 <- ggplot(dd,aes(x=time,y=percent_t_s, fill=group)) +geom_col(position="dodge")+
  labs(title="Total sensory",x="Time after local anesthetic injection(min)", y= "Proportion of patients with sensory block (%)")+
  geom_text(aes(label = (total_s)),position = position_dodge(0.9),vjust = 1.5,hjust = 0.5)+
  geom_text(aes(label = round(percent_t_s,1)),position = position_dodge(0.9),vjust = -0.5,hjust = 0.5)+
  theme_bw()+
  theme(legend.position = c(.15, .9))



p4 <- ggplot(dd,aes(x=time,y=percent_t_m, fill=group)) +geom_col(position="dodge")+
  labs(title="Total motor",x="Time after local anesthetic injection(min)", y= "Proportion of patients with motor block (%)")+
  geom_text(aes(label = (total_m)),position = position_dodge(0.9),vjust = 1.5,hjust = 0.5)+
  geom_text(aes(label = round(percent_t_s,1)),position = position_dodge(0.9),vjust = -0.5,hjust = 0.5)+
  theme_bw()+
  theme(legend.position = c(.15, .9))

(p1+p2)/
(p3+p4)  

#  p1|p2

#  p1/p2