Learn R Programming

osmplotr (version 0.1-3)

add_colourbar: add_colorbar

Description

Adds a colourbar to an existing map. Intended to be used in combination with add_osm_surface (). At present, only plots on right side of map.

Usage

add_colourbar(len = c(0.1, 0.9), width = 0.02, side = 1, cols = NULL,
  zlims = c(0, 1), transp = 0.4, tcol = "black", ps = 8)

Arguments

len
Relative positions of start and end of colourbar
width
Relative width
side
(1,2,3,4) for colourbar (below, left, above, right) of map. (Not yet implemented.)
cols
Vector of colours
zlims
Vector of (min,max) values for scale of colourbar. These should be the values returned from add_osm_surface ().
transp
Transparency level of region immediately surrounding colourbar, including behind text. Lower values are more transparent.
tcol
Colour of text, tick marks, and lines on colourbar
ps
PointSize of text labels

Examples

Run this code
plot_osm_basemap (bbox=get_bbox (c (-0.15, 51.5, -0.1, 51.52)), col="gray20")
add_osm_objects (london$dat_BNR, col="gray40") # non-residential buildings
add_axes ()
add_colourbar (cols=heat.colors(20), tcol="white", side=4)

Run the code above in your browser using DataLab