I have created a heat map using geom_tile
with a legend that shows the values of the colour gradient, with the following code:
scale_fill_gradient2(name = "log2(fold change)",
low = "navy",
mid = "white",
midpoint = 0,
high = "red",
breaks = c(-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4),
limits = c(-9,5),
guide = guide_colorbar(frame.colour = "black",
ticks.colour = "black",
barheight = 13.5))
This is what I get:
I have noticed that the red colour at the top range is not as it should be for high = "red"
.
When I extend the limit to +9 (limits = c(-9,9)
)I can see that the specified colour at the top range is correct:
How can I set the true red
colour at upper limit 5?