[R] Gradient plots in ggplot2

phii m@iii@g oii phiiipsmith@c@ phii m@iii@g oii phiiipsmith@c@
Tue Mar 9 05:05:52 CET 2021

I am having trouble with a gradient fill application in ggplot2, caused 
by outlier values. In my reprex, most of the values are between 2 and 
-2, but there are two outliers, 10 and -15. The outliers stand out well, 
which is good, but all the other numbers show almost no colour 
variation. I would like to continue with bold colours for the outliers, 
while having a more variable gradient, perhaps but not necessarily in a 
different colour, for the values between 2 nd -2. Any ideas on how this 
can be done?

a <- c(rep(1,6),rep(2,6),rep(3,6),rep(4,6))
b <- c(0.1, 0.5,-0.3, 1.2,-0.4,-1.2,
        0.7, 0.8,-1.2,-0.5,10.0, 0.3,
        0.2,-0.4,-15.,-0.4,-0.9,  NA,
        0.1, 1.3,-1.4, 0.5,-0.5, 0.1)
c <- c(rep(c("a","b","c","d","e","f"),4))
df <- data.frame(a,b)

More information about the R-help mailing list