Project Part 2

Interactive and static plots of the number of farms.

  1. Packages I will use to read in and plot the data.
  1. Read the data in from part 1
country_farms <- read_csv(here::here("country_farms.csv"))

Interactive graph

country_farms  %>% 
  group_by(Country) %>% 
  mutate(Farms = round(Farms, 2), 
         Year = paste(Year, "12", "31", sep="-")) %>% 
  e_charts(x = Year)   %>% 
  e_river(serie = Farms, legend=FALSE)  %>% 
  e_tooltip(trigger = "axis")  %>% 
  e_title(text = "Number of farms, per country",
          subtext = "(in millions of farms). Source: Our World in Data",
          sublink = "https://ourworldindata.org/farm-size#how-many-farms-are-there",
          left = "center")  %>%
  e_theme("roma")
ggsave(filename = here::here("_posts/2022-05-16-project-part-2/preview.png"))

Static graph

country_farms   %>% 
  ggplot(aes(x = Year, y = Farms,
             fill = Country)) +
  geom_area() +
  colorspace::scale_fill_discrete_divergingx(palette = "roma", nmax =7) +
  theme_classic() +
  theme(legend.position = "bottom") +
  labs( y = "in millions of Farms",
        fill = NULL)

These plots do not accurately depict the data that was in the data set I chose as they were not the type of graph that would display this data properly. If I were to do this project again I would have chosen a different data set.