Description Usage Arguments See Also
View source: R/climate.stripes.r
This draws a colour gradient legend for use as a climate stripes legend. It uses rect to draw many rectangles (500) and colours each with a ramp palette so that it appears as a smooth gradient. It is also possible to do this as a rasterImage but these images can be hard to work with and do not scale properly especially for multiplot layouts.
1 2 3 4 5 6 7 8 9 10 11 12 | colour.gradient.legend.f(
xleft,
ybottom,
xright,
ytop,
colour.vec = c("blue", "red"),
ncolours = 500,
labels = T,
var.min.label,
var.max.label,
text.col.legend
)
|
xleft |
the lower left x coordinate of the legend |
ybottom |
the lower left y coordinate of the legend |
xright |
the upper right x coordinate of the legend |
ytop |
the upper right y coordinate of the legend |
colour.vec |
a vector of colours to ramp between (see colorRampPalette, "colors") |
ncolours |
the number of colours to show on the legend. Default is 500, a large number produces a smooth legend colour gradient |
labels |
default TRUE. If TRUE then values you supply (var.min.label) and (var.max.label) are shown on the legend |
var.min.label |
the value for the highest temperature to show on the legend |
var.max.label |
the value for the lowest temperature to show on the legend |
text.col.legend |
colour of the legend text |
rect colorRampPalette
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.