In continuation of the topic I am trying to depict 2D surface using ggplot. The colors are determined by scale_fill_gradient2
, however they are too bright and dull when the values are close to 0 (white color). I have tried scale_colour_hue
to change saturation, but it doesnot work.
names(plot2d) <- c("x", "y", "z")
ggplot(plot2d) + aes(x, y, z = z, fill = z) + geom_tile(aes(fill = z)) +
scale_fill_gradient2(limits=c(-40, 40), "height",
low=rgb(0,255,0, maxColorValue = 255), mid = "white",
high=rgb(255,0,0, maxColorValue = 255), guide="colorbar") +
geom_raster(interpolate=TRUE) + geom_contour(color = "white", alpha = 0.5)
# + scale_colour_hue(h=c(180, 270))