Usage
createMap(data, maptype = "terrain", mapColor = c("color", "bw"),
source = c("google", "osm", "stamen", "cloudmade"), location = NULL,
locator = "center", boxBorderMargin = 10, zoom = NULL,
locationName = NULL, lonName = "LONGITUDE", latName = "LATITUDE",
metricName = NULL, labelName = NULL, scaleRange = c(1, 6),
shapeColour = "red", textColour = "black", textFamily = "mono",
textFace = "plain", textSize = 4, facet = NULL, ncol = 1,
facetScales = "fixed", geocodeFun = memoise::memoise(geocode),
getmapFun = get_map, urlonly = FALSE, api_key = NULL, baseSize = 12,
baseFamily = "sans", title = NULL, legendPosition = "right",
defaultTheme = theme_bw(base_size = baseSize), themeExtra = NULL)
Arguments
data
data frame with artifacts and their locations and metric(s) to be placed
on the map. If location name is provided (with locationName
) then it is used to
gecode artifacts first. If not location then longitude and latitude must be provided.
maptype
map theme as defined in get_map
. options available are 'terrain',
'satellite', 'roadmap', and 'hybrid' mapColor
color ('color'
) or black-and-white ('bw'
)
source
Google Maps ('google'), OpenStreetMap ('osm'), Stamen Maps ('stamen'), or
CloudMade maps ('cloudmade')
location
location of the map: longitude/latitude pair (in that order), or
left/bottom/right/top bounding box: 'center' uses 2 value vector for the center of the map,
while 'box' uses 4 value vector as left/bottom/right/top. If missing then function will
deri
locator
in absence of location
specifies how to use data to determine map
location: when 'center' then function averages out data point longitude and latitude values
to get approximate cneter for the map; when 'box' it will use min/max of longitu
boxBorderMargin
margin size in percent of box sizes to increase box when computed
from data locations.
zoom
map zoom as defined in get_map
: an integer from 3 (continent)
to 21 (building), default value 10 (city). Properly setting zoom
for each map is
responsibility of a caller. Zoom is optional w locationName
name of the column with strings to be geocoded to determine longitude and
latitude for each data point. If this value is specified then parameters lonName
and
latName
are ignored.
lonName
name of the column with longitude value. This value (in combination with value
from column latName
) is used to place each data point on the map. This parameter is
ignored if locationName
is defined.
latName
name of the column with latitude value. This value (in combination with value
from column lonName
) is used to place each data point on the map. This parameter is
ignored if locationName
is defined.
metricName
name of the column to use for the artifact metric when displaying data.
labelName
name of the column to use for the artifact label text when displaying data.
scaleRange
a numeric vector of lenght 2 that specifies the minimum and maximum size
of the plotting symbol after transformation (see parameter range
of scale_size
). shapeColour
color of of artifact placed on map.
textColour
color of artifact labels on map.
textFamily
font family (when available) to use for artfiact labels.
textFace
font style to apply to artifact labels: 'plain' (default), 'bold', 'italic', or
'bold.italic'.
textSize
font size of artifact labels.
facet
name of a column to divide plot into facets for specificed parameter (defualt is
NULL - no facets). If facet is single value then facet wrap applied (see facet_wrap
),
otherwise facet grid (see
ncol
number of facet columns (applies when single facet column supplied only - see
parameter facet
).
facetScales
Are scales shared across all facets: "fixed" - all are the same, "free_x" - vary
across rows (x axis), "free_y" - vary across columns (Y axis) (default), "free" - both rows and
columns (see in facet_wrap
parameter scales
).
geocodeFun
geocode function. Default is geocode
but due to Google API
restrictions use memoised version, e.g. memoise(geocode)
, instead (see package memoise). getmapFun
get map function. Defayult is get_map
but due to map APIs restrictions
use memoised version, e.g. memose(get_map)
, instead (see package memoise). api_key
an api key for cloudmade maps.
baseFamily
base font family.
legendPosition
the position of legends. ("left", "right", "bottom", "top", or two-element
numeric vector. "none" is no legend.)
defaultTheme
plot theme to use, default is theme_bw
.
themeExtra
any additional ggplot2
theme attributes to add.