Reader small image

You're reading from  Applied Data Visualization with R and ggplot2

Product typeBook
Published inSep 2018
Reading LevelIntermediate
Publisher
ISBN-139781789612158
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Dr. Tania Moulik
Dr. Tania Moulik
author image
Dr. Tania Moulik

Tania Moulik has a PhD in particle physics. She has worked at CERN, the European Organization for Nuclear Research, and on the Tevatron at Fermi National Accelerator Laboratory in IL, USA. She has years of programming experience in C++, Python, and R. She has also worked in the feld of big data and has worked with technologies such as grid computing. She has a passion for data analysis and would like to share her passion with others who would like to delve into the world of data analytics. She especially likes R and ggplot2 as a powerful analytics package.
Read more about Dr. Tania Moulik

Right arrow

More on the Grammar of Graphics


The Grammar of Graphics is the language used to describe the various components of a graphic that represent data in a visualization. In this topic, you will learn more about the Grammar of Graphics and will use it to make plots. You wille-encounter some of the Grammar of Graphics terms used in the previous chapter.

We will now break down the Grammar of Graphics language, in order to understand the terms in greater detail. 

Layers

In ggplot2, every plot is built up as a layer. Layers are made up of geometric objects (geoms), their statistical transformations (stats), and their thematic aspects. Hence, each plot can be thought of as a separate variable, in and of itself. Aesthetic mappings, defined withaes(), describe how variables are mapped to visual properties, or  aesthetics. The following diagram depicts the use of the df and aes functions:

Let's look at an example. We will use the gapminder dataset. You can see the available variables in the following snippet...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Applied Data Visualization with R and ggplot2
Published in: Sep 2018Publisher: ISBN-13: 9781789612158

Author (1)

author image
Dr. Tania Moulik

Tania Moulik has a PhD in particle physics. She has worked at CERN, the European Organization for Nuclear Research, and on the Tevatron at Fermi National Accelerator Laboratory in IL, USA. She has years of programming experience in C++, Python, and R. She has also worked in the feld of big data and has worked with technologies such as grid computing. She has a passion for data analysis and would like to share her passion with others who would like to delve into the world of data analytics. She especially likes R and ggplot2 as a powerful analytics package.
Read more about Dr. Tania Moulik