In developing plots, I often use color (or “colour” in ggplot2 parlance) to reflect values of a third, non-X/Y, variable. Depending on the distribution of this Z variable, however, the effective color range can be narrow, making it difficult to discriminate between Z values, as in this plot:

As you can see, the bulk of the points are in the middle, yellow/white range, while green/blue and orange/red only appear near the edges. This is as it should be, since Z = X * Y, and there are relatively few extreme values. However, I am, in a sense, “wasting” a lot of the color range available to me. Fortunately, the package scales offers a function called trans_new(), which permits one to apply any function on the distribution, as I do below. (Thanks to “mnel” at stackoverflow.com.)

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

Zero Inflated Models and Generalized Linear Mixed Models with R.
Zuur, Saveliev, Ieno (2012).