Now that every team has played a match it will be interesting to see how this has affected the (inverse) odds of victory. Since the plot in my last post was a bit ‘busy’, I have decided to use the facet_wrap function in gglplot2 to stratify by group.

Also, re-producing the ‘busy’ plot from the last post yields the following.

Germany, despite not playing well, has gained, while the Netherlands, despite playing quite well, have declined. These two countries will play each other in the next round, so it will be interesting to see how a victory for the Netherlands would change these graphics.

Data and code:

# after loading data as object called eur
n <- dim(eur)[1]
eur <- t(eur[1:n,])
dat <- NULL
for(i in 1:n){dat <- data.frame(rbind(dat,cbind(eur[-1,i],names(eur[-1,i]),i)))}
dat$V1 <- 1/as.numeric(as.character(dat$V1))
dat$V3 <- as.character(dat$V2)
dat$V3[dat$i!=n] <- c("")
dat$group <- ifelse(dat$V2 %in% c("RUS","GRE","POL","CZE"),"Group.A","Group.D")
dat$group <- ifelse(dat$V2 %in% c("GER","NED","POR","DEN"),"Group.B",dat$group)
dat$group <- ifelse(dat$V2 %in% c("IRL","CRO","ITA","ESP"),"Group.C",dat$group)
dat$i <- as.numeric(as.character(dat$i))
ggplot(dat, aes(x=i, y=V1, colour = V2, group=V2, label=V3)) +
geom_line(size=0.8) + geom_point(size=4, shape=21, fill="white") + #theme_bw() +
geom_text(hjust=-0.3, vjust=0) +
scale_x_continuous('Day',limits=c(1,(n+0.4)),breaks=1:n) +
scale_y_continuous('1/Odds') +
theme_bw() +
opts(title = expression("Euro 2012, Inverse Odds of Victory"),
legend.position=c(80,80))
ggplot(dat, aes(x=i, y=V1, colour = V2, group=V2, label=V3)) +
geom_line(size=0.8) + geom_point(size=4, shape=21, fill="white") + #theme_bw() +
geom_text(hjust=-0.3, vjust=0.4) +
scale_x_continuous('Day',limits=c(1,(n+0.8)),breaks=1:n) +
scale_y_continuous('1/Odds') +
facet_wrap( ~ group, ncol = 2, scales="free_y") +
theme_bw() +
opts(title = expression("Euro 2012, Inverse Odds of Victory"),
legend.position=c(80,80))

### Like this:

Like Loading...

*Related*

The example of the Netherlands winning the next game example seems to be very remote (I might be biased…🙂 )

Thanks for the code! How do you crape the odds? From http://www.oddschecker.com/football/internationals/euro-2012/winner?

And a beginners question: Is there a way in ggplot2 to add additional lines/highlights for the “game days” to each facet?

Hey Jan,

I take the odds from the same bookmaker everyday. The bookmaker is one of the ones quoted on the oddschecker site, but I have left it unnamed as I do not want to be seen as promoting a particular gambling website.

As to your other question, I am sure there is a way to draw attention to the matchdays. Possibly using the geom_vline function. I am not sure what the exact code would be however.