見出し画像

2022年都道府県別致死率

  • 表題の通り。

  • 棒グラフ。

  • factorを使用したx軸ラベル表示順序制御を行なった。

  • 同じくラベル変則縦書き。

  • 感染者数と死者数のタイムラグは21日間を想定。

w <- (dplyr::filter(dmdf,t>'2022-01-22')[-48] %>% apply(.,2,sum)) / (dplyr::filter(mdf,t>'2022-01-01' & t < Sys.Date()-21)[-48] %>% apply(.,2,sum))
# df <- as.data.frame(w[order(w)],colnames(w))
df <- data.frame(d=w[order(w)],r=pref_jp[order(w)])
df$r <- factor(df$r,levels=pref_jp[order(w)])
p <- ggplot(df)
p <- p + geom_bar(stat = "identity",aes(x=r,y=d*100,fill=r)) 
p <- p + theme_gray (base_family = "HiraKakuPro-W3")
p <- p + xlab("") + ylab("2022年致死率(%)")
p <- p + theme(legend.position = 'none')  # erase legend
p <- p + theme(axis.text.x = element_text(angle = 90, hjust = 1))
plot(p)
png("~/Dropbox/R-script/covid/w.png", width = 1200, height = 1000)
plot(p)
dev.off()


この記事が気に入ったらサポートをしてみませんか?