Learn R Programming

osmplotr (version 0.2.0)

add_axes: add_axes

Description

Adds axes to the internal region of an OSM plot.

Usage

add_axes(map, colour = "black", pos = c(0.02, 0.03), alpha = 0.4,
  fontsize = 3, fontface, fontfamily)

Arguments

map
A ggplot2 object to which the axes are to be added
colour
Colour of axis (determines colour of all elements: lines, ticks, and labels)
pos
Positions of axes and labels relative to entire plot device
alpha
alpha value for semi-transparent background surrounding axes and labels (lower values increase transparency)
fontsize
Size of axis font
fontface
Fontface for axis labels (1:4=plain,bold,italic,bold-italic)
fontfamily
Family of axis font (for example, 'Times')

Value

  • Modified version of map with axes added

See Also

plot_osm_basemap.

Examples

Run this code
bbox <- get_bbox (c (-0.13, 51.5, -0.11, 51.52))
map <- plot_osm_basemap (bbox=bbox, bg="gray20")
map <- add_osm_objects (map, london$dat_BNR, col="gray40") 
map <- add_axes (map)
print (map)

# Map items are added sequentially, so adding axes prior to objects will
# produce a different result.
map <- plot_osm_basemap (bbox=bbox, bg="gray20")
map <- add_axes (map)
map <- add_osm_objects (map, london$dat_BNR, col="gray40") 
print (map)

Run the code above in your browser using DataLab