Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ggplot2 Essentials

You're reading from   ggplot2 Essentials Explore the full range of ggplot2 plotting capabilities to create meaningful and spectacular graphs

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher
ISBN-13 9781785283529
Length 234 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Donato Teutonico Donato Teutonico
Author Profile Icon Donato Teutonico
Donato Teutonico
Arrow right icon
View More author details
Toc

Adding statistics

In the previous chapter, you saw how plots are composed of different components and how the data, aesthetic mapping, and geometry are the three minimally required elements needed in order to make a plot. In reality, statistics are also needed in order to draw a plot, but it is not necessarily needed to be specified since, as we have seen in the previous chapter, each geometry has default statistics, which, in many cases, are simply the identity statistics. This stat transformation actually does not produce anything on the data but leaves the data as it is in the plot. Another common stat that you have already used, probably without realizing it, is bin, which is used by default, for instance, in histograms and barplots, to divide the data into bins that are then represented in the graph.

The default stat used from each geom function will be sufficient in most common situations, but in some cases, it could be important for you to use a different stat or add an additional...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image