library(ggplot2)
df <- data.frame(
stringsAsFactors = FALSE,
EPG = c("S&D","S&D","Greens/EFA","Greens/EFA",
"ALDE","ALDE","EPP","EPP","ECR",
"ENF","S&D","ALDE","EPP","GREENS/EFA",
"ALDE","ECR","GUE/NGL","EPP","ALDE",
"Greens/EFA","GUE/NGL","EPP","ECR",
"Greens/EFA","GUE/NGL","S&D","EPP",
"GUE/NGL","ECR","S&D","S&D","EPP",
"Greens/EFA","ALDE","Greens/EFA",
"Greens/EFA","GUE/NGL","ALDE","GUE/NGL","S&D",
"Greens/EFA","EPP","ENF","ALDE",
"GUE/NGL","ECR","EPP","GUE/NGL","ENF",
"EPP"),
EP = c("3","1","1","1","3","3","2","2",
"4","1","3","2","1","1","1","4",
"1","29","3","11","7","5","7","1",
"1","2","5","6","1","2","14","16",
"4","1","1","1","5","2","1","13",
"6","20","23","7","1","1","4","3",
"6","1"),
variable = c("Left-Right","Left-Right","Left-Right",
"Left-Right","Left-Right",
"Left-Right","Left-Right","Left-Right",
"Left-Right","Left-Right","Left-Right",
"Left-Right","Left-Right","Left-Right",
"Left-Right","Left-Right","Left-Right",
"Left-Right","Left-Right","Left-Right",
"Left-Right","Left-Right","Left-Right",
"Left-Right","Left-Right","Left-Right",
"Left-Right","Left-Right","Left-Right",
"Left-Right","Left-Right","Left-Right",
"Left-Right","Left-Right","Left-Right",
"Left-Right","Left-Right","Left-Right",
"Left-Right","Left-Right","Left-Right",
"Left-Right","Left-Right","Left-Right",
"Left-Right","Left-Right",
"Left-Right","Left-Right","Left-Right",
"Left-Right"),
value = c(3.14411754432958,3.51470587281574,
2.77352940113754,2.77352940113754,
7.22058823120675,7.22058823120675,
4.81176479089965,5.7382353804974,7.96176488817907,
9.25882334302768,4.81176479089965,
6.01617627943555,7.22058823120675,
3.42205890650303,7.22058823120675,7.12794126489403,
2.58823528321799,6.22285083709243,
6.7929865702838,4.08484160600712,
1.8755656630523,7.43438910799175,9.00226214265039,
3.74632352021518,5.05882336773356,
5.16176462670848,7.42647065650952,
2.58823528321799,8.86764698509948,
5.26470579303633,4.25588234449394,7.49852959338019,
2.58823528321799,6.57205900378244,
4.13235296342993,2.69117654219291,
2.27941169158737,5.8823526983564,2.35661763581856,
4.28676466659818,3.59191172439987,
7.83823513652682,9.66310194068103,
6.20989312677925,2.31029410633867,
6.17830881790928,6.87316176010759,2.70404410691771,
8.94117604550173,5.63235276269464),
party_name = as.factor(c("PS",
"SPA","ECOLO","Groen","MR",
"VLD","cdH","CD&V","N-VA","VB",
"SD","RV","KF","SF","V",
"DF","FolkB","CDU","FDP",
"Grunen","Linke","CSU","AfD",
"Piraten","DieTier","PASOK",
"ND","SYRIZA","ANEL","Potami",
"PSOE","PP","IU","EAJ/PNV",
"ERC","ICV","Podemos",
"C's","PCF","PS","EELV","UMP",
"FN","MODEM","PG","FF","FG",
"SF","LN","UDC"))
)
ggplot(df,aes(x=factor(EPG,levels=c("EPP","S&D","ECR","ALDE","GUE/NGL","Greens/EFA","EFFD","ENF")),y=value,color=EPG,weight=EP))+
geom_jitter(position=position_jitter(width=0.2,height=0),alpha=0.8)+
geom_boxplot(alpha=0,show.legend=FALSE,lwd=1)+
scale_color_manual(limits=c("EPP","S&D","ECR","ALDE","GUE/NGL","Greens/EFA","EFDD","ENF"),
values=c("#fcdd22","#fc1414","#106da8","#ec008c","#c6262c","#44911d","#00abbc","black"))+
guides(color=guide_legend(""))+
theme(legend.position="bottom",
axis.text.y=element_blank(),
axis.ticks=element_blank())+
labs(x="",y="",title="Figure 1",subtitle="Left-right")+
facet_grid(variable~.)+
coord_flip()
#> Warning: Removed 50 rows containing non-finite values (stat_boxplot).
#> Warning: Removed 1 rows containing missing values (geom_point).