代码
df<-read.csv("../../WHO-COVID-19-global-data.csv",header=T,
stringsAsFactors = F)
head(df)
df1<-df[df$Country_code=="US"|df$Country_code=="IN",]
head(df1)
table(df1$Country_code)
table(df1$Country)
library(ggplot2)
df2<-na.omit(df1)
x_labels<-paste("2020-0",1:7,"-11",sep="")
x_labels
ggplot(df2,aes(x=Date_reported,y=New_cases,group=Country_code))+
geom_point(aes(color=Country_code))+
geom_line(aes(color=Country_code))+
scale_x_discrete(breaks=x_labels,
labels=x_labels)+
theme_bw()+
ggtitle("美国和印度每日新增确诊人数")+
theme(legend.title = element_blank(),
legend.position = "top",
plot.title = element_text(hjust=0.5))+
labs(x="",y="")+
scale_color_manual(values=c("red","blue"))+
scale_y_continuous(breaks=c(0,20000,40000,60000),
labels = c("0","2万","4万","6万"))
结果