Honeybee Production
Graphs of honeybee production using FAO data
Prepare Data
# devtools::install_github("derekmichaelwright/agData")
library(agData)
# Prep data
<- "www.dblogr.com/ or derekmichaelwright.github.io/dblogr/ | Data: FAOSTAT"
myCaption #
<- agData_FAO_Livestock %>% filter(Item == "Bees") dd
Global Colonies
# Prep data
<- dd %>% filter(Area == "World")
xx # Plot
<- ggplot(data = xx, aes(x = Year, y = Value / 1000000)) +
mp geom_col(fill = "darkgreen", alpha = 0.7) +
scale_x_continuous(breaks = seq(1960, 2020, by = 5)) +
theme_agData() +
labs(title = "Global Honey Bee Colonies", x = NULL,
y = "Stocks (Millions)", caption = myCaption)
ggsave("honeybee_01.png", mp, width = 6, height = 4)
Regions
# Prep data
<- c("World", "Asia", "Africa", "South America",
myAreas "Northern America", "Europe")
<- c("black", "darkgoldenrod2", "darkred", "steelblue",
myColors "darkgreen", "darkblue")
<- dd %>% filter(Area %in% myAreas) %>%
xx mutate(Area = factor(Area, levels = myAreas))
# Plot
<- ggplot(xx, aes(x = Year, y = Value / 1000000, fill = Area)) +
mp geom_col(alpha = 0.7) +
facet_wrap(Area ~ ., scales = "free_y", ncol = 3) +
scale_x_continuous(breaks = seq(1965, 2015, by = 10)) +
scale_fill_manual(values = myColors) +
theme_agData(legend.position = "none") +
labs(title = "Honey Bee Colonies", x = NULL,
y = "Stocks (Millions)", caption = myCaption)
ggsave("honeybee_02.png", mp, width = 8, height = 4)
USA
# Prep data
<- dd %>% filter(Area == "USA")
xx # Plot
<- ggplot(xx, aes(x = Year, y = Value / 1000000)) +
mp geom_col(fill = "darkgreen", alpha = 0.7) +
theme_agData() +
labs(title = "USA Honey Bee Colonies", y = "Million Colonies",
x = NULL, caption = myCaption)
ggsave("honeybee_03.png", mp, width = 6, height = 4)
Honeybees vs. Sugarbeet
# Prep data
<- dd %>% rename(Beehives=Value)
x1 <- agData_FAO_Crops %>%
x2 filter(Item == "Sugar beet", Measurement == "Production") %>%
rename(Sugar.beet=Value)
<- left_join(x1, x2, by = c("Area","Year")) %>%
xx filter(Area %in% c("Northern America", "Western Europe"))
# Plot
<- ggplot(xx, aes(x = Sugar.beet / 1000000, y = Beehives / 1000000)) +
mp geom_path(alpha = 0.3) +
geom_point(aes(color = Year), size = 2) +
stat_smooth(geom = "line", method = "lm", size = 1.5, alpha = 0.5) +
scale_color_gradient(low = "steelblue", high = "darkred") +
facet_wrap(Area ~ ., scales = "free") +
theme_agData() +
labs(y = "Million Beehive Colonies",
x = "Million Tonnes of Sugar Beet",
caption = myCaption)
ggsave("honeybee_04.png", mp, width = 8, height = 4)