8.1 How Graphing Works
R has a base graphing package, graphics
, which utilizes the plot()
function. However, most R users use the ggplot2
package (preloaded with the tidyverse package). This is because ggplot2 is more powerful, allows for greater customization, and is fairly user friendly. I highly recommend Hadley Wickham’s book, ggplot2 – Elegant Graphics for Data analysis, for additional guidance on more specific graphing tools and techniques. I will go over a few graphing techniques that cannot encompass the needs of everyone reading this book. The primary focus of this section will be line graphs, but we will briefly touch on bar graphs, histograms, and scatterplots.
As always, refer back to the troubleshooting section (Section 3.6) when you come across errors in your code. When searching the internet for help, I recommend adding “ggplot2” to the end of your query to ensure that it is focused on the type of graphing utilized in this section.