Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
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

Equivalent coding between qplot and ggplot


In this section, we will have a look at how we can realize a few of the plots we introduced in Chapter 2, Getting Started, with the ggplot() function we have introduced in this chapter. The idea is that you can use this simple roadmap as guidance on how to use the ggplot() function to generate several kinds of plots, building on the knowledge of qplot() that you already have. We will not go into too much detail about the different plots since many basic concepts have already been introduced in the previous chapter and they apply to both functions.

In the following examples, we will use a few of the geom and stat functions listed in the summary tables previously presented; just remember that for each of these functions, you can map different aesthetic attributes. You can find a list of such attributes in the summary tables or in the help page of the function.

Histograms and density plots

In order to obtain a histogram, we will use the ggplot() function...

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 $15.99/month. Cancel anytime
Visually different images