I would like to change the size and the position of the legend for the vertical lines in my plot. Here is the code:
central_values <- data.frame(measurement = c("mean", "median"),
value = c(mean(CBGrecord_days[,2]), median(CBGrecord_days[,2])))
ggplot(CBGrecord_days, aes(x=CBGrecord_days[,2])) +
geom_histogram(color="darkblue", fill="lightblue", binwidth=17)+
xlab("Number of days recorded")+ # for the x axis label
ylab("Number of individuals")+
scale_y_continuous(breaks=c(seq(0,40,5)))+
scale_x_continuous(breaks=c(seq(0,230,15)))+
geom_vline(data = central_values, aes(xintercept = value, color = measurement),size=1.2)+
scale_color_manual(values = c("red", "darkblue"), name = NULL) +
theme(panel.background = element_rect(fill = "white", colour = "grey50"),
axis.text=element_text(size=32),
axis.title=element_text(size=40))+guides(color = guide_legend(title=NULL))
Thank you!