[R] Dual colour ramps based on pos/neg values

From: Tyler Hayes <hayes.tyler_at_gmail.com>
Date: Thu, 21 Apr 2011 22:48:59 -0400


Hi Everyone:

I'm going a little nuts here and am hoping someone might have some ideas to help out. Here is my problem:

I am using the calendarHeatMap function
(
http://blog.revolutionanalytics.com/2009/11/charting-time-series-as-calendar-heat-maps-in-r.html) to plot some values of percentages above or below a watermark. In other words, I have a time series whose data can range arbitrarily from -0.34 to +1.9, for example.

However, for the visualization to be effective, I need to be able to distinguish conclusively where the division between positive and negative takes place. My original thought was to just modify the colorRampPalette function inputs to achieve the effect. Unfortunately, because of the smooth blending, it washes out the middle. Not to mention the middle of the colour range is not always zero.

What I would to do is concatenate two colour ranges such that:

bright red (max negative) -> dark red (min negative) dark green (min positive) -> chartreuse (max positive)

I know, chartreuse. Not to mention the fact that the these ranges will change with each dataset I apply. Now, believe me, I have tried searches for colorramp range, positive, and so on, but can't seem to find a smoking gun that will work with the function above. I came across the ggplot package as well, which looks promising (book ordered and en route), but I believe this function uses a different graphic methodology.

Any help in the right direction is greatly appreciated.

Cheers,

t.

GPG Key ID: 0xF38F6BEE



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 22 Apr 2011 - 02:50:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 22 Apr 2011 - 10:30:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive