plotOnMap: Create interactive plot of data on map of Sweden

Description Usage Arguments Value See Also Examples

View source: R/plotOnMap.r

Description

This function takes in data on Swedish municipalities, and creates a plot of said data on an interactive map of Sweden.

Usage

1
plotOnMap(dat, tooltips = NA, mainTitle = NA, subTitle = NA, legendTitle = "")

Arguments

dat

Either a data frame of two columns, the first of which contains names of municipalities and the second the data, or a named list, where the names are names of municipalities. Allowed to be partial data, municipalities without data have their data automatically set to NA.

tooltips

A data frame with two columns, the first of which contains the name of a municipality and the second the tooltip that should be shown for that municipality. If omitted, tooltips are generated automatically from the data.

mainTitle

Main title of the plot, displayed at the top. If omitted, plot has no title.

subTitle

Subtitle of the plot, displayed right below the title. If omitted, plot has no subtitle.

legendTitle

Title of the legend of the plot. If omitted, legend has no title - so don't omit this.

Value

A ggplot object that can be turned into an interactive graphic with the girafe function, see the example.

See Also

exampleForestPlot

Examples

1
2
3
4
5
library(ggplot2)
library(ggiraph)
exampledata <- data.frame(municipality = c("Stockholm", "Lund", "Uppsala"),
                          students = c("some", "many", "loads"))
girafe(ggobj = plotOnMap(exampledata))

vagdur/SCBHandlerPlotter documentation built on March 28, 2021, 11:35 p.m.