gmap: Initialize a Bokeh Google Map plot

Description Usage Arguments Note See Also Examples

View source: R/fig_gmap.R

Description

Initialize a Bokeh Google Map plot

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
gmap(
  lat = 0,
  lng = 0,
  zoom = 0,
  api_key = NULL,
  map_type = "hybrid",
  map_style = NULL,
  width = 480,
  height = 480,
  title = NULL,
  xlab = NULL,
  ylab = NULL,
  xlim = NULL,
  ylim = NULL,
  padding_factor = 0.07,
  xgrid = FALSE,
  ygrid = FALSE,
  xaxes = FALSE,
  yaxes = FALSE,
  tools = c("pan", "wheel_zoom", "save"),
  theme = getOption("bokeh_theme")
)

Arguments

lat

latitude where the map should be centered

lng

longitude where the map should be centered

zoom

initial zoom level to use when displaying the map

api_key

Google Maps API key

map_type

map type to use for the plot - one of "hybrid", "satellite", "roadmap", "terrain"

map_style

a json string of a Google Maps style - see gmap_style

width

figure width in pixels

height

figure width in pixels

title

a title to display above the plot. - "title" is also the prefix for a set of Text Properties, so you can set the font for the title with the parameter text_font.

xlab

label for x axis

ylab

label for y axis

xlim

the extent of the plotting area in the x-dimension (will be computed automatically if not specified).

ylim

the extent of the plotting area in the y-dimension (will be computed automatically if not specified).

padding_factor

if limits are not specified, by what factor should the extents of the data be padded

xgrid

whether to draw x axis grid lines

ygrid

whether to draw y axis grid lines

xaxes

where to put x axis, or FALSE if no x axis ticks / labels

yaxes

where to put y axis, or FALSE if no y axis ticks / labels

tools

character vector of interactivity tools options (acceptable values are: "pan", "wheel_zoom", "box_zoom", "resize", "crosshair", "box_select", "lasso_select", "reset", "save", "help"). Additionally, tool functions can be called on a figure to specify more control - see the "See Also" section below for a list of tool functions. If NULL, the toolbar will not be drawn. If "" the toolbar will be drawn but no tools will be added by default.

theme

an rbokeh theme to use

Note

This can be used in the same way as figure, adding layers on top of the Google Map. There is an open issue documenting points appearing to sometimes be a few pixels off from their intended location. Google has its own terms of service for using Google Maps API and any use of rbokeh with Google Maps must be within Google's Terms of Service

See Also

gmap_style

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# custom map style
gmap(lat = 40.74, lng = -73.95, zoom = 11,
  width = 600, height = 600,
  map_style = gmap_style("blue_water"))

## Not run: 
gmap(title = "NYC taxi pickups January 2013",
  lat = 40.74, lng = -73.95, zoom = 11,
  map_type = "roadmap", width = 1000, height = 800) %>%
  ly_hexbin(nyctaxihex, alpha = 0.5,
    palette = "Spectral10", trans = log, inv = exp)

## End(Not run)

rbokeh documentation built on Aug. 4, 2021, 1:06 a.m.