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

The coordinate system


The coordinate system adjusts the mapping from coordinates to the 2D plane of the computer screen. Among the different coordinate systems available in ggplot2, the Cartesian system is the most common coordinate system for two dimensions, while the polar coordinate system is often used for special plots, such as pie charts. When you create a plot, the coordinate system for the graph will be set with default values, which, in most cases, would be Cartesian coordinates. If you want a different coordinate system, you can overwrite the default value using the appropriate function. Such functions have the general form coord_x, where x is replaced by the specific coordinate desired.

The following is a table summarizing the main functions of coordinate systems; a more exhaustive list can be found on the package website:

Main coord functions

Description

coord_cartesian(xlim, ylim)

This is a Cartesian coordinate system.

xlim and ylim can be used to provide limits for the...