Book Image

ggplot2 Essentials

By : Donato Teutonico
Book Image

ggplot2 Essentials

By: Donato Teutonico

Overview of this book

Table of Contents (14 chapters)
ggplot2 Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Exploring scales


We already discussed scales in different situations but, in this case, we will focus on certain general aspects that will turn out to be essential for you to understand how to fully utilize the different scales available. Generally speaking, the scales are assigned during the aesthetic mapping and are then used to define guides to trace from the represented objects back to the data by creating legends as well as the plot axis. You can add a scale to your plot or modify the default values of the scale using one of the scale functions. These functions have the general structure of scale_aesthetic_scale, where aesthetic represents the aesthetic on which the scale is applied and scale represents the name of the scale on which it is used. Typical aesthetic values can be, for instance, color, x, y, fill, shape, or size, while examples of scales are hue, brewer, gradient, and log10. So, for instance, the scale_color_gradient() function defines the gradient of colors. Take for example...