Subsetting and sorting your data;
valact <- subset(val, variable=='actual')
valsort <- valact[ order(-valact[,"Value"]),]
From there it's just a standard boxplot()
with a very manual cumulative function on top:
op <- par(mar=c(3,3,3,3))
bp <- barplot(valsort [ , "Value"], ylab="", xlab="", ylim=c(0,1),
names.arg=as.character(valsort[,"State"]), main="How's that?")
lines(bp, cumsum(valsort[,"Value"])/sum(valsort[,"Value"]),
ylim=c(0,1.05), col='red')
axis(4)
box()
par(op)
which should look like this
(source: eddelbuettel.com)
and it doesn't even need the overplotting trick as lines()
happily annotates the initial plot.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…