Saskatchewan Lentil Production and Exports
Graphs of lentil production and exports using SKAG data
Data
Prepare Data
myCs_Regions <- c("darkred","darkgreen","darkorange","darkblue","grey")
myCs_Lens <- c("darkgreen", "darkgoldenrod3", "darkred", "black")
myCrops <- c("Large Green Lentils","Small Green Lentils",
"Red Lentils","Other Lentils")
myCaption <- "www.dblogr.com/ or derekmichaelwright.github.io/dblogr/ | Data: STATCAN"
#
x1 <- agData_STATCAN_Crops %>%
filter(Item == "Lentils", Measurement == "Production",
Area == "Saskatchewan")
x2 <- read.csv("lentil_timeline.csv")
d1 <- full_join(x1, x2, by = "Year") %>%
mutate(Value = ifelse(is.na(Value), 0, Value))
#
d2 <- agData_SKAG_Specialty_Crops %>%
filter(grepl("Lentil", Item), Item != "Total Lentils") %>%
mutate(Item = factor(Item, levels = myCrops))
#
d3 <- agData_SKAG_Lentil_Exports %>%
left_join(agData_FAO_Country_Table, by = c("Area"="Country"))
Timeline
# Plot
mp <- ggplot(d1, aes(x = Year)) +
geom_segment(aes(xend = Year, y = Value / 1000000, yend = Nudge_y), alpha = 0.7) +
geom_label(aes(label = Event, y = Nudge_y, fill = Type),
size = 3, alpha = 0.6, hjust = 1) +
geom_area(aes(y = Value / 1000000), fill = "darkgreen", alpha = 0.7, color = I("Black")) +
scale_fill_manual(values = c("darkred", "darkorange", "steelblue")) +
scale_x_continuous(breaks = seq(1970,2020, by = 10),
limits = c(1935, 2021), expand = c(0,0)) +
scale_y_continuous(expand = c(0,0), limits = c(0,4)) +
theme_agData(legend.position = "none",
panel.grid.major.x = element_blank(),
panel.grid.minor.x = element_blank()) +
labs(title = "Saskatchewan Lentil Industry", x = NULL,
y = "Production (Million Tonnes)", caption = myCaption)
ggsave("lentil_saskatchewan_1.png", mp, width = 6, height = 4)