project part 2

Interactive and static plots of flops in super computers in 2015

  1. Packages that I will use to read in and plot all of the data
  1. read the data in from part 1
computer_flops  <- read_csv(here::here("supercomputer-power-flops.csv"))

Interactive graph

-start with the data -group_by year so there will be a “river” for each year -use mutate to read the flops for the super computers so only one year will appear when you hover over the graph -use mutate to change the year so it will display as end of the year instead the beginning of the year
-use e_charts to create an e_charts object with the year on the x axis -use e_river to build “rivers” that contain the flops by year. The depth of each river represents the amount of flops that had been occurring in that year -also use e_tooltip, e_title, e_theme to update the title, subtitle, the x-axis and the theme of the graph

computer_flops %>%
  group_by(`Floating-Point Operations per Second`) %>% 
  mutate(Year = round(`Floating-Point Operations per Second`, 2),
         Year = paste(Year, "24", "2", sep = "-"))
# A tibble: 29 x 4
# Groups:   Floating-Point Operations per Second [21]
   Entity Code     Year          `Floating-Point Operations per Seco~`
   <chr>  <chr>    <chr>                                         <dbl>
 1 World  OWID_WRL 1.24e+11-24-2                               1.24e11
 2 World  OWID_WRL 1.7e+11-24-2                                1.7 e11
 3 World  OWID_WRL 1.7e+11-24-2                                1.7 e11
 4 World  OWID_WRL 3.68e+11-24-2                               3.68e11
 5 World  OWID_WRL 1.3e+12-24-2                                1.3 e12
 6 World  OWID_WRL 1.3e+12-24-2                                1.3 e12
 7 World  OWID_WRL 2.4e+12-24-2                                2.4 e12
 8 World  OWID_WRL 4.9e+12-24-2                                4.9 e12
 9 World  OWID_WRL 7.2e+12-24-2                                7.2 e12
10 World  OWID_WRL 3.59e+13-24-2                               3.59e13
# ... with 19 more rows
e_chart(x = ) %>% 
  e_river(serie = computer_flops, legend = FALSE) %>%
  e_tooltip(trigger = "axis") %>%
  e_title(text = "Number of flops within the super computers by years",
          subtext = "(by per second) source Our world in Data", 
          sublink = "https://ourworldindata.org/grapher/supercomputer-power-flops", 
          left = "center") %>%
  e_theme("roma")

static graph

-start with the data -use ggplot to create a new ggplot object. Use aes to indicate that year will be mapped to the x axis; and flops will be the y axis; and the flops per second will be the data that is filled in -geom_area will display the flops -scale_fill_discrete_divergingx is a function in the color space package it will set a color palatte to roma and selects a maximum of 12 colors for the different years -theme_classic sets the theme -theme(legend.position = “bottom”) puts the legend ar the bottom of the plot -labs set the y axis label, fill = null indicates that the fill variable will not have the labelled year.

computer_flops %>%
  ggplot(aes(x = Year, y = , 
             fill = `Floating-Point Operations per Second`))

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