tab <- with(
subset(d.pizza, driver %in% c("Carpenter","Miller","Farmer","Butcher")),
table(factor(driver), Weekday(date, "a", stringsAsFactor=TRUE))
)
tab
barplot(tab, beside=FALSE, space=1.2)
AddConnLines(tab, beside=FALSE, space=1.2, lcol="grey50", lwd=1, lty=2)
barplot(tab, beside=FALSE, space=1.2, horiz=TRUE)
AddConnLines(tab, beside=FALSE, space=1.2, horiz=TRUE, lcol="grey50", lwd=1, lty=2)
cols <- PalHelsana()[1:4]
b <- barplot(tab, beside=FALSE, horiz=FALSE, col=cols)
AddConnLines(tab, beside=FALSE, horiz=FALSE, lcol="grey50", lwd=1, lty=2)
# set some labels
text(x=b, y=t(apply(rbind(0,tab), 2, Midx)), labels=tab,
col=(matrix(rep(TextContrastColor(cols), each=ncol(tab)), nrow=nrow(tab), byrow=FALSE )))
Run the code above in your browser using DataLab