R Question

Modify arguments in scale_fill_gradient

I am using "scale_fill_gradient" to draw figures with ggplot2. Any of you know if we can modify arguments in (). For example:


Then I would like to modify as


Thanks a lot!

Answer Source

There is probably a duplicate, but

scale_fill_gradient(low = "red", high = "grey", limits = c(-0.03, 1.07)

should do the job. This is shown in the second example of the documentation of scale_fill_gradient. Please read the documentation.