-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Data Wrangling with R
By :

Every phrase can be broken down into grammatical elements, such as subject, pronouns, and adjectives. When read together, words will make sense, forming a sentence and delivering a message. Likewise, as seen previously, there is a grammar for graphics as well, breaking the creation of a plot down into layers that can be added together to create a visual.
To understand the basics of how to write ggplot2 code, we will follow a set of questions to walk us through the process smoothly. Whenever there is a need to use the library, return to this template until the logic is absorbed and the coding becomes natural.
To create a basic plot in ggplot2, let us answer the following questions:
These questions can be translated into the following code:
# What is the dataset to be used? ggplot(data) + ...
Change the font size
Change margin width
Change background colour