Togaware DATA MINING
Desktop Survival Guide
by Graham Williams
Google

Waterfall Plots

Image rplot-waterfall01


# From Thomas Petzoldt on r-help 31 Oct 2008
pdf("graphics/rplot-waterfall01.pdf")
# Sample data
x <- 0:99
y <- sort(rnorm(100), decreasing=TRUE)
# Plot
plot(y, type="n")
polygon(c(min(x), x, max(x), 0), c(0, y, 0, 0), col="green")
dev.off()

http://rattle.togaware.com/code/rplot-waterfall01.R

Image rplot-waterfall02


# From Gabor Grothendieck on r-help 1 Nov 2008
pdf("graphics/rplot-waterfall02.pdf")
growth <- sort(runif(215, -100, 100), decreasing = TRUE)
col <- factor(1 + (growth < -25) + (growth < 25),
              lab = c("black", "grey50", "grey80"))
barplot(growth, col = levels(col)[col], ylab = "% Growth",
        main = "Random Data", xlab = "", space = 0, border = 0,
        ylim = c(-100, 100))
legend("topright", legend = c("> 25%", "25% > . > -25%", "< 25%"),
       cex = 0.8, bty = "n", fill = levels(col))
legend("bottomleft", "Random data with style of: Ratain et al, JCO,
       2006, Fig 2", cex = 0.6, bty = "n")
dev.off()

http://rattle.togaware.com/code/rplot-waterfall02.R



Copyright © Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
The PDF version is a formatted comprehensive draft book (with over 800 pages).
Brought to you by Togaware. This page generated: Sunday, 22 August 2010