Project Part 2

Interactive and static plots of The Average American’s Diet Breakdown from 1961 to 2013

  1. Packages I will use to read in and plot the data
  1. Read the data in from part 1
usa_diet2  <- read_csv(here::here("_posts/2022-04-27-project-part-1/usa_diet2.csv"))

Interactive Graph

usa_diet2  %>%
  group_by(`Food Group`)  %>%
  e_charts(x = `Year`)   %>% 
  e_river(serie = `Calories`, legend=FALSE)  %>% 
  e_tooltip(trigger = "axis")  %>% 
  e_title(text = "America's Daily Caloric Intake Composition",
          subtext = "(breakdown based on the year's daily avg. calorie intake) Source: Our World in Data",
          sublink = "https://ourworldindata.org/grapher/dietary-compositions-by-commodity-group?country=~USA",
          left = "center")  %>% 
  e_theme("roma")  

Static Graph

ggplot(usa_diet2, aes(x=Year, y=`Food Group`, color= `Calories`)) + geom_point(size = 1.2) +
colorspace::scale_fill_discrete_divergingx(palette = "roma", nmax =11) +
theme_classic() +
  theme(legend.position = "bottom") +
  labs( y = "Food Groups")

These plots show a steady in total caloric intake since 1961 and the Food Groups: Oils & Fats and Sugar still among the biggest portions of one’s daily intake. Although, since 1961 the amount of calories that Cereals and Grains takes up, has steadily grown.

ggsave(filename = here::here("_posts/2022-04-27-project-part-2/preview.png"))