Я сделал тепловую карту с geom_tile
, содержащим эту легенду.
This is the code within ggplot()
that I used:
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))
In my current plot, it creates the legend and shows the colour gradient, ranging from -9 to 5.
My question is how to crop the legend, so that it only shows the values ranging from -4 to 5, without changing the colour gradient ( как в этом примере ). Как этого добиться?