Description Usage Arguments Value Examples
View source: R/get_density_map2.R
This is a very similar function
to get_density_map
, but this one plots a similar map with two gradients in the same scale with a break set to the value zero and changes the default values of the arguments gradmin
and gradmax
.
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 two gradients in the same scale.
1 |
data |
The |
fill_by |
The |
legend |
The |
title |
The |
gradmin |
Lowest value shown in the gradient scale. Default: -32. |
gradmax |
Highest value shown in the gradient scale. Default: 42. |
gradnum |
Number of intervals shown in the gradient scale. Default: 4. |
colors |
The color gradient of "fill_by" info. Default: "#a32424",#FFFFFF","#224d77". |
Plots a map with two gradients in the same scale with a break around zero. The map uses epsg: 3035 as a projection (Azimuthal equal area focused on the European Union) showing the values of the selected column
from the selected dataframe
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Country <- c("Austria", "Belgium", "Bulgaria", "Croatia")
EPP <- c(7,22,31,-27)
SD <- c(41,-15,28,-30)
Other <- c(35,22,-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_map2(t_world, t_world$SD, legend="Gains/Losses", title= "Seats Gained or Lost by SD")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.