Manipulating position scales for continuous and discrete data in ggplot2 (CC154)
ggplot2 allows you to manipulate the appearance of position scales on your x and y axes for displaying continuous and discrete data. This episode of Code Club will show you how you can use various options in scale_x_continuous/scale_y_continuous and scale_x_discrete/scale_y_discrete to modify their appearance. With these functions, Pat also describes how they differ from coord_cartesian and xlim/ylim/limits and how to modify the padding at the ends of the axes using the expand argument and expansion helper function. The data depict the percentage of people in 15 countries who would be willing to receive the COVID-19 vaccine as of August and October of 2020.
In this episode, Pat uses a variety of functions from ggplot2 to manipulate a figure using RStudio.
You can browse the state of the repository at the
august_october_2020.csv data is available in the GitHub repository.
X.1,Total Agree - August 2020,Total Agree - October 2020 Total,77,73 India,87,87 China,97,85 South Korea,84,83 Brazil,88,81 Australia,88,79 United Kingdom,85,79 Mexico,75,78 Canada,76,76 Germany,67,69 Japan,75,69 South Africa,64,68 Italy,67,65 Spain,72,64 United States,67,64 France,59,54