get_density_map: Creates a map with a gradient scale.

Description Usage Arguments Value Examples

View source: R/get_density_map.R

Description

This function creates a map based on the dataframe assigned to argument data that creates a map showing the values of the column assigned to the fill_by argument with a gradient scale.

Usage

1
get_density_map(data, fill_by, legend = "", title = "", gradmin = 0, gradmax = 100, gradnum = 4, colors = c("#FFFFFF", "#224d77"))

Arguments

data

The dataframe with the polygon data and other data.

fill_by

The column that with the desired info to be shown in the map.

legend

The string to be used as legend of the map.

title

The string to be used as title of map.

gradmin

Lowest value shown in the gradient scale. Default: 0.

gradmax

Highest value shown in the gradient scale. Default: 100.

gradnum

Number of intervals shown in the gradient scale. Default: 4.

colors

The color gradient of "fill_by" info. Default: "#FFFFFF","#224d77".

Value

Plots a map with a gradient scale using epsg: 3035 as a projection (Azimuthal equal area focused on the European Union) showing the values of the selected column from the selected dataframe.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Country <- c("Austria", "Belgium", "Bulgaria", "Croatia")
EPP <- c(7,22,31,48)
SD <- c(41,15,28,33)
Other <- c(35,42,10,5)
IN <- c(25,34,42,14)
df.data <- data.frame(Country, EPP, SD, Other, IN)
library("rnaturalearth")
library("rnaturalearthdata")
library("ggplot2")
world <- ne_countries(scale = "medium", returnclass = "sf")

t_world <- merge(world, df.data, by.x="name_long", by.y="Country")


get_density_map(t_world, t_world$EPP, legend="Seats", title= "Seats Held by EPP", gradmax=50, gradnum =5)

bclroger/euparliament documentation built on Jan. 26, 2020, 12:56 a.m.