- Packages I will use to read in and plot the data.
- Read the data in from part 1
direct_deaths <- read_csv(here::here("_posts/2022-05-10-project-part-1/direct_deaths.csv"))
Interactive graph
- Start with the data
- We matched the E-charts with the description
- We added the bars to the chart using e-bar
- Use e_tooltip to add a tooltip that will display based on the axis values
- Use e_title to add a title, subtitle and link to subtitle
Static Group
- Start with the data
- Use ggplot to create a new object.
- Use pivot_longer to display columns 1-5 and label values as “desc” and “n”.
- Use coord_flip to relocate the graph’s position.
- theme_classic sets the theme -theme(legend.position = “bottem”) puts the legend at the bottem of the plot.
- labs sets the y axis label, fill = NULL indicates that the fill variable will not have the labelled Deaths.
labs(y = "millions",
fill = NULL)
$y
[1] "millions"
$fill
NULL
attr(,"class")
[1] "labels"
This graph shows the importance of drug related education, in order to lower deaths, and save lives.
ggsave(filename = here::here("_posts/2022-05-17-project-part-2/preview.png"))