読者です 読者をやめる 読者になる 読者になる

廿TT

譬如水怙牛過窓櫺 頭角四蹄都過了 因甚麼尾巴過不得

(ggplot2)順位の入れ替わりプロット

グラフ

なんと呼ぶのかわからないグラフ

f:id:abrahamcow:20161027012625p:plain

library(cowplot)
set.seed(100)
old <- data.frame(Group = "old", Rank = 1:5,
                  Text = c("一郎","次郎","三郎","四郎","五郎"))
new <- data.frame(Group = "new",
                  Rank = sample(1:5),
                  Text =  c("一郎","次郎","三郎","四郎","五郎"))
df <- rbind(old,new)
ggplot(df, aes(x=Group, y=Rank, group=Text, label=Text)) +
  geom_line(size=1) +
  scale_y_reverse() +
  geom_text(data = subset(df, Group == "new"),hjust=0,family = "HiraMaruProN-W4",size=7)+
  geom_text(data = subset(df, Group == "old"),hjust=1,family = "HiraMaruProN-W4",size=7)

参考: