Learn R Programming

COVID19 (version 0.2.1)

geomap: Animated Mapping

Description

Visualize data across the space and time dimensions by animated mapping.

Usage

geomap(
  x,
  map = "world",
  value = "confirmed",
  label = "",
  filename = "",
  width = 1920,
  height = 1080,
  title = "Coronavirus: {closest_state}",
  text.size = 48,
  caption = "",
  caption.size = 18,
  colour = "#bdbdbd",
  fill = "#2a2a28",
  background = "#000f1a",
  point.alpha = 0.95,
  point.size = c(1, 32),
  point.colour = c("#ffaa00", "#a20f0e"),
  legend.title = "",
  legend.background = "transparent",
  legend.position = c(0, 0),
  legend.barheight = 24,
  legend.barwidth = 3,
  ...
)

Arguments

x

data.frame containing the columns lat (latitude), lng (longitude) and date (time). See world, diamond, italy and switzerland.

map

map data. The string choices include 'world', 'italy', 'switzerland' and more (type help(package='maps') to see the package index). See map for details.

value

the value column.

label

the label column.

filename

file name to create on disk. Use .gif for animations, .png for static images.

width, height

plot size.

title

the title. Dynamic label variables are available from transition_states.

text.size

the text size.

caption

the caption. Dynamic label variables are available from transition_states.

caption.size

the caption size.

colour

the text colour.

fill

the fill colour.

background

the background color.

point.alpha

the point opacity.

point.size

a numeric vector of length 2 that specifies the minimum and maximum size of the plotting symbol.

point.colour

a character vector of length 2 that specifies the colours corresponding to the lowest and highest values.

legend.title

the legend title. Dynamic label variables are available from transition_states.

legend.background

the legend background.

legend.position

the legend position, c(0,0) corresponds to bottom-left, c(1,1) to top-right.

legend.barheight

the height of the colourbar.

legend.barwidth

the width of the colourbar.

...

additional arguments passed to animate

Value

The return value of the animate function.

Examples

Run this code
# NOT RUN {
# download data
it <- italy()

# add label
it$label <- factor(it$confirmed)

# map
geomap(it,
  map = "italy",
  value = "confirmed",
  label = "label",
  title = "Coronavirus: {closest_state}",
  caption  = "Data source: ...",
  legend.title = "Total cases",
  nframes = 30+(2*length(unique(it$date))),
  end_pause = 30)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab