Quantcast
Channel: グラフ - 廿TT
Viewing all articles
Browse latest Browse all 123

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

$
0
0

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

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)

参考:


Viewing all articles
Browse latest Browse all 123

Trending Articles