Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Add a column that categorizes the y
values, then map that column to fill. In this
example, we'll first categorize the values as positive or
negative:
library(gcookbook)# For the data setcb<-subset(climate,Source=="Berkeley")cb$valence[cb$Anomaly10y>=0]<-"pos"cb$valence[cb$Anomaly10y<0]<-"neg"cbSource Year Anomaly1y Anomaly5y Anomaly10y Unc10y valence Berkeley1800NANA-0.4350.505neg Berkeley1801NANA-0.4530.493neg Berkeley1802NANA-0.4600.486neg...Berkeley2002NANA0.8560.028pos Berkeley2003NANA0.8690.028pos Berkeley2004NANA0.8840.029pos