As you said youself, you want the oob
argument in the scale_fill_gradient
. To clamp values, you can use squish from the scales package (scales
is installed when ggplot2
is installed):
library(scales)
and later
scale_fill_gradient(low = "red", high = "green", limits=c(0.6, 1), oob=squish)
More Related Contents:
- ggplot with 2 y axes on each side and different scales
- Plot multiple columns on the same graph in R [duplicate]
- Remove space between plotted data and the axes
- How to use an image as a point in ggplot?
- Simpler population pyramid in ggplot2
- How to put labels over geom_bar in R with ggplot2
- Wrap long axis labels via labeller=label_wrap in ggplot2
- Local Variables Within aes
- What do hjust and vjust do when making a plot using ggplot?
- how to add layers in ggplot using a for-loop
- How can I add hatches, stripes or another pattern or texture to a barplot in ggplot?
- How do I change the formatting of numbers on an axis with ggplot? [duplicate]
- Making a stacked bar plot for multiple variables – ggplot2 in R
- Change ggplot factor colors
- Include space for missing factor level used in fill aesthetics in geom_boxplot
- “Density” curve overlay on histogram where vertical axis is frequency (aka count) or relative frequency?
- how to change the color in geom_point or lines in ggplot [duplicate]
- How to fill with different colors between two lines? (originally: fill geom_polygon with different colors above and below y = 0 (or any other value)?)
- ggplot geom_point() with colors based on specific, discrete values
- GGplot custom scale transformation with custom ticks
- Asymmetric expansion of ggplot axis limits
- How to add shaded confidence intervals to line plot with specified values
- ToolTip when you mouseover a ggplot on shiny
- ggplot2: Fix colors to factor levels
- How to automatically adjust the width of each facet for facet_wrap?
- Is it possible to jitter two ggplot geoms in the same way?
- Draw lines between different elements in a stacked bar plot
- Removing Unused Factors from a Facet in ggplot2
- Adding percentage labels on pie chart in R
- show multiple plots from ggplot on one page in r