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:

scale_fill_gradient(low="red",high="grey")


Then I would like to modify as

scale_fill_gradient(-0.03="red",1.07="grey")


Thanks a lot!

Answer

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.

Comments