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

Bubble charts and dot plots


In the scatterplot section, we have seen how bivariate data can be represented in a typical x-y plot. In some cases, you may need to represent an additional variable in your plot, and we have already seen how different colors can be used to represent different types of data. One other option is to use the size of the symbols; if you are representing the data in points, you can, for instance, change the point size to represent an additional property of your data (an additional variable). This type of plot is usually called a bubble chart.

We can see a very easy example using the movie dataset we created in the Bar charts example. Please refer to that section for how to create this dataset.

We can create a plot of the different types of movies versus time by adding the size attribute of the symbol (in this case, they are points) to represent the budget of the movie. This is an example of the code to generate such a plot:

qplot(Year, Type, data=myMovieData, size=Budget...
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 £13.99/month. Cancel anytime
Visually different images