[R] Dual colour ramps based on pos/neg values
Tyler Hayes
hayes.tyler at gmail.com
Fri Apr 22 04:48:59 CEST 2011
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
More information about the R-help
mailing list