# Simulated data trade in Northern America
data("datatrade_NorthAm")
# Mean of internal production for each country
library(dplyr)
data_plot <- datatrade_NorthAm$internal_production %>%
group_by(reporter) %>%
summarise(mean_value = mean(value))
head(data_plot)
#Plot
pl <- plot_countries(data = data_plot,
iso_col = "reporter",
values_col = "mean_value")
pl
# Changing colors and adding other ggplot2 options
library(ggplot2)
pl <- plot_countries(data = data_plot,
iso_col = "reporter",
values_col = "mean_value",
colors = c("white", "lightblue", "darkblue"),
title = "Plot internal production",
legend_title = "units")
pl +
xlim(-170, -20) + ylim(10, 90) +
theme_bw()
Run the code above in your browser using DataLab