Currently, the plot legend works in the range from 0.5 to -0.25, I would like to increase this to 1 to -1 with a gap after each interval of 0.25. How can i do this.
If I use scale_fill_continous (), it overrides my previous populated z value. So the solution will be
+ scale_fill_continuous (breaks = cl (-1.1, s = 0.25), low = 'white', high = 'SteelBlue')
but there is an error saying Error in unit(tic_pos.c, "mm") : 'x' and 'units' must have length > 0 I tried with another example where I mentioned a range from 0 to 1, but it still starts from 0.555, depending on max. and min z value
The legend needs to be increased in size, so the colors must also match it, which means the value is -1 and the high is +1.
The whole idea is that tiles with a value of about -0.25 (in the middle) should not be white, since they are not the lowest, the lowest is -1, the color -0.25 should be light blue if the value is lower which is displayed on the chart or not, since one provides user limits.
Example:

Code to create it
pp <- function (n,r=4) { x <- seq(-r*pi, r*pi, len=n) df <- expand.grid(x=x, y=x) df$r <- sqrt(df$x^2 + df$y^2) df$z <- cos(df$r^2)*exp(-df$r/6) df } ggplot(pp(20),aes(x=x,y=y))+geom_tile(aes(fill=z))
r layout plot ggplot2
Sukhdeep singh
source share