1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
library(ggplot2)
gtitle <- paste(anadata2$X2,"_",anadata2$X3,sep='')[1]
p <- ggplot(anadata2,aes(x=as.Date(date))) +
geom_col(aes(y=ana_new,fill="g_col")) +
geom_line(aes(y=mean_new,color="g_line"),size=1) +
ggtitle(gtitle) +
labs(x=NULL,y=NULL) +
scale_x_date(date_label="%y/%m/%d",
date_breaks = "3 month",
minor_breaks = "1 month") +
scale_fill_manual(breaks = c("g_col"),
values = c("#cad5e5"),
label = c("New Case")) +
scale_color_manual(breaks = c("g_line"),
values = c("blue"),
label = c("Monving Average")) +
theme(plot.title =element_text(hjust = 0.5, vjust = 0.5),
legend.position = "bottom",
legend.title = element_blank(),
legend.background = element_blank())
p + theme(panel.background=element_rect(fill='transparent',
color='gray'),
legend.key=element_rect(fill='transparent',
color='transparent'))
|