R Data Visualization Cookbook
()
About this ebook
- Create animated and interactive plots to help you communicate and explore data
- Utilize various R packages to generate graphs, manipulate data, and create beautiful presentations
- Learn to interpret data and tell a story using this step-by-step guide to data visualization
If you are a data journalist, academician, student or freelance designer who wants to learn about data visualization, this book is for you. Basic knowledge of R programming is expected.
Related to R Data Visualization Cookbook
Related ebooks
R: Recipes for Analysis, Visualization and Machine Learning Rating: 0 out of 5 stars0 ratingsR Graphs Cookbook Second Edition Rating: 3 out of 5 stars3/5RStudio for R Statistical Computing Cookbook Rating: 0 out of 5 stars0 ratingsPractical Data Analysis Cookbook Rating: 0 out of 5 stars0 ratingsPython Data Visualization Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsIBM SPSS Modeler Cookbook Rating: 0 out of 5 stars0 ratingsmatplotlib Plotting Cookbook Rating: 5 out of 5 stars5/5Python Data Analysis Cookbook Rating: 5 out of 5 stars5/5Python Business Intelligence Cookbook Rating: 0 out of 5 stars0 ratingsTableau 10 Business Intelligence Cookbook Rating: 0 out of 5 stars0 ratingsMicrosoft Tabular Modeling Cookbook Rating: 0 out of 5 stars0 ratingsTableau Cookbook – Recipes for Data Visualization Rating: 0 out of 5 stars0 ratingsData Visualization with D3.js Cookbook Rating: 0 out of 5 stars0 ratingsggplot2 Essentials Rating: 0 out of 5 stars0 ratingsR: Data Analysis and Visualization Rating: 5 out of 5 stars5/5Mastering Data Analysis with R Rating: 5 out of 5 stars5/5Learning RStudio for R Statistical Computing Rating: 4 out of 5 stars4/5Data Analysis with R Rating: 5 out of 5 stars5/5Big Data Analytics with R Rating: 0 out of 5 stars0 ratingsIntroduction to R for Business Intelligence Rating: 0 out of 5 stars0 ratingsMastering Predictive Analytics with R Rating: 4 out of 5 stars4/5R for Data Science Rating: 5 out of 5 stars5/5Mastering Text Mining with R Rating: 0 out of 5 stars0 ratingsR and Data Mining: Examples and Case Studies Rating: 3 out of 5 stars3/5Data Mining Applications with R Rating: 4 out of 5 stars4/5Learning Tableau 10 - Second Edition Rating: 4 out of 5 stars4/5Introduction to Data Science Using R Rating: 0 out of 5 stars0 ratingsTableau Your Data!: Fast and Easy Visual Analysis with Tableau Software Rating: 4 out of 5 stars4/5R Data Science Essentials Rating: 2 out of 5 stars2/5Learning Predictive Analytics with R Rating: 0 out of 5 stars0 ratings
Enterprise Applications For You
Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Excel Formulas and Functions 2020: Excel Academy, #1 Rating: 4 out of 5 stars4/5101 Ready-to-Use Excel Formulas Rating: 4 out of 5 stars4/5Bitcoin For Dummies Rating: 4 out of 5 stars4/5Microsoft Power Platform A Deep Dive: Dig into Power Apps, Power Automate, Power BI, and Power Virtual Agents (English Edition) Rating: 0 out of 5 stars0 ratingsEnterprise AI For Dummies Rating: 3 out of 5 stars3/5Excel 2019 For Dummies Rating: 3 out of 5 stars3/5The New Email Revolution: Save Time, Make Money, and Write Emails People Actually Want to Read! Rating: 5 out of 5 stars5/5Learn Windows PowerShell in a Month of Lunches Rating: 0 out of 5 stars0 ratingsExcel Guide for Success Rating: 5 out of 5 stars5/5Excel 2019 Bible Rating: 4 out of 5 stars4/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Excel Formulas That Automate Tasks You No Longer Have Time For Rating: 5 out of 5 stars5/5Experts' Guide to OneNote Rating: 5 out of 5 stars5/5ChatGPT Ultimate User Guide - How to Make Money Online Faster and More Precise Using AI Technology Rating: 0 out of 5 stars0 ratings50 Useful Excel Functions: Excel Essentials, #3 Rating: 5 out of 5 stars5/5QuickBooks Online For Dummies Rating: 0 out of 5 stars0 ratingsExcel Tips and Tricks Rating: 0 out of 5 stars0 ratingsData Governance: How to Design, Deploy and Sustain an Effective Data Governance Program Rating: 4 out of 5 stars4/5Essential Office 365 Third Edition: The Illustrated Guide to Using Microsoft Office Rating: 3 out of 5 stars3/5Learning Microsoft Azure Rating: 4 out of 5 stars4/5QuickBooks 2023 All-in-One For Dummies Rating: 0 out of 5 stars0 ratingsBuilding Web Services with Microsoft Azure Rating: 0 out of 5 stars0 ratingsEvernote Essentials Guide (Boxed Set): Evernote Guide For Beginners for Organizing Your Life Rating: 3 out of 5 stars3/5MrExcel XL: The 40 Greatest Excel Tips of All Time Rating: 4 out of 5 stars4/5
Reviews for R Data Visualization Cookbook
0 ratings0 reviews
Book preview
R Data Visualization Cookbook - Atmajitsinh Gohil
Table of Contents
R Data Visualization Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. A Simple Guide to R
Installing packages and getting help in R
Getting ready
How to do it…
How it works…
There's more…
See also
Data types in R
How to do it…
Special values in R
How to do it…
How it works…
Matrices in R
How to do it…
How it works…
Editing a matrix in R
How to do it…
Data frames in R
How to do it…
Editing a data frame in R
How to do it...
Importing data in R
How to do it...
How it works…
Exporting data in R
How to do it…
How it works…
Writing a function in R
Getting ready
How to do it…
How it works…
See also
Writing if else statements in R
How to do it…
How it works…
Basic loops in R
How to do it…
How it works…
Nested loops in R
How to do it…
The apply, lapply, sapply, and tapply functions
How to do it…
How it works…
Using par to beautify a plot in R
How to do it…
How it works…
Saving plots
How to do it…
How it works…
2. Basic and Interactive Plots
Introduction
Introducing a scatter plot
Getting ready
How to do it…
How it works…
Scatter plots with texts, labels, and lines
How to do it…
How it works…
There's more…
See also
Connecting points in a scatter plot
How to do it…
How it works…
There's more…
See also
Generating an interactive scatter plot
Getting ready
How to do it…
How it works…
There's more…
See also
A simple bar plot
How to do it…
How it works…
There's more…
See also
An interactive bar plot
Getting ready
How to do it…
How it works…
There's more…
See also
A simple line plot
Getting ready
How to do it…
How it works…
See also
Line plot to tell an effective story
Getting ready
How to do it…
How it works…
See also
Generating an interactive Gantt/timeline chart in R
Getting ready
How to do it…
See also
Merging histograms
How to do it…
How it works…
Making an interactive bubble plot
How to do it…
How it works…
There's more…
See also
Constructing a waterfall plot in R
Getting ready
How to do it…
3. Heat Maps and Dendrograms
Introduction
Constructing a simple dendrogram
Getting ready
How to do it…
How it works…
There's more...
See also
Creating dendrograms with colors and labels
Getting ready
How to do it…
How it works…
There's more…
Creating a heat map
Getting ready
How to do it…
How it works…
There's more…
See also
Generating a heat map with customized colors
Getting ready
How to do it…
How it works…
Generating an integrated dendrogram and a heat map
How to do it…
There's more…
See also
Creating a three-dimensional heat map and a stereo map
Getting ready
How to do it…
See also
Constructing a tree map in R
Getting ready
How to do it…
How it works…
There's more…
See also
4. Maps
Introduction
Introducing regional maps
Getting ready
How to do it…
How it works…
See also
Introducing choropleth maps
Getting ready
How to do it…
How it works…
There's more…
See also
A guide to contour maps
How to do it…
How it works…
There's more…
See also
Constructing maps with bubbles
Getting ready
How to do it…
How it works...
There's more…
See also
Integrating text with maps
Getting ready
How to do it…
See also
Introducing shapefiles
Getting ready
How to do it…
See also
Creating cartograms
Getting ready
How to do it…
See also
5. The Pie Chart and Its Alternatives
Introduction
Generating a simple pie chart
How to do it…
How it works…
There's more...
See also
Constructing pie charts with labels
Getting ready
How to do it…
How it works…
There's more…
Creating donut plots and interactive plots
Getting rady
How to do it...
How it works…
There's more…
See also
Generating a slope chart
Getting ready
How to do it…
How it works…
See also
Constructing a fan plot
Getting ready
How to do it…
How it works…
6. Adding the Third Dimension
Introduction
Constructing a 3D scatter plot
Getting ready
How to do it…
How it works…
There's more…
See also
Generating a 3D scatter plot with text
Getting ready
How to do it…
How it works…
There's more…
See also
A simple 3D pie chart
Getting ready
How to do it…
How it works…
A simple 3D histogram
Getting ready
How to do it…
How it works…
There's more...
Generating a 3D contour plot
Getting ready
How to do it…
How it works…
Integrating a 3D contour and a surface plot
Getting ready
How to do it…
How it works…
There's more...
See also
Animating a 3D surface plot
Getting ready
How to do it…
How it works…
There's more…
See also
7. Data in Higher Dimensions
Introduction
Constructing a sunflower plot
Getting ready
How to do it…
How it works…
See also
Creating a hexbin plot
Getting ready
How to do it…
How it works…
See also
Generating interactive calendar maps
Getting ready
How to do it…
How it works…
See also
Creating Chernoff faces in R
Getting ready
How to do it…
How it works…
Constructing a coxcomb plot in R
Getting ready
How to do it…
How it works…
See also
Constructing network plots
Getting ready
How to do it…
How it works…
There's more…
See also
Constructing a radial plot
Getting ready
How to do it…
How it works…
There's more…
See also
Generating a very basic pyramid plot
Getting ready
How to do it…
How it works…
See also
8. Visualizing Continuous Data
Introduction
Generating a candlestick plot
Getting ready
How to do it…
How it works…
There's more…
See also
Generating interactive candlestick plots
Getting ready
How to do it…
How it works…
Generating a decomposed time series
How to do it…
How it works…
There's more…
See also
Plotting a regression line
How to do it…
How it works…
See also
Constructing a box and whiskers plot
Getting ready
How to do it…
How it works…
See also
Generating a violin plot
Getting ready
How to do it…
Generating a quantile-quantile plot (QQ plot)
Getting ready
How to do it…
See also
Generating a density plot
Getting ready
How to do it…
How it works…
There's more…
See also
Generating a simple correlation plot
Getting ready
How to do it…
How it works…
There's more…
See also
9. Visualizing Text and XKCD-style Plots
Introduction
Generating a word cloud
Getting ready
How to do it…
How it works…
There's more…
See also
Constructing a word cloud from a document
Getting ready
How to do it…
How it works…
There's more…
See also
Generating a comparison cloud
Getting ready
How to do it…
How it works…
See also
Constructing a correlation plot and a phrase tree
Getting ready
How to do it…
How it works…
There's more…
See also
Generating plots with custom fonts
Getting ready
How to do it…
How it works…
See also
Generating an XKCD-style plot
Getting ready
How to do it…
See also
10. Creating Applications in R
Introduction
Creating animated plots in R
Getting ready
How to do it…
How it works…
Creating a presentation in R
Getting ready
How to do it…
How it works…
There's more…
See also
A basic introduction to API and XML
Getting ready
How to do it…
How it works…
See also
Constructing a bar plot using XML in R
Getting ready
How to do it…
How it works…
See also
Creating a very simple shiny app in R
Getting ready
How to do it…
How it works…
See also
Index
R Data Visualization Cookbook
R Data Visualization Cookbook
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: January 2015
Production reference: 1240115
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-950-8
www.packtpub.com
Credits
Author
Atmajitsinh Gohil
Reviewers
Sharan Kumar Ravindran
Kannan Kalidasan
Erik M. Rodríguez Pacheco
Arun Padmanabhan
Juan Pablo Zamora
Patric Zhao
Commissioning Editor
Kartikey Pandey
Acquisition Editor
Neha Nagwekar
Content Development Editor
Arun Nadar
Technical Editors
Rohit Kumar Singh
Mitali Somaiya
Copy Editors
Nithya P
Shambhavi Pai
Rashmi Sawant
Project Coordinator
Neha Bhatnagar
Proofreaders
Simran Bhogal
Stephen Copestake
Paul Hindle
Joanna McMahon
Indexer
Priya Sane
Graphics
Disha Haria
Abhinash Sahu
Production Coordinator
Nilesh R. Mohite
Cover Work
Nilesh R. Mohite
About the Author
Atmajitsinh Gohil works as a senior consultant at a consultancy firm in New York City. After graduating, he worked in the financial industry as a Fixed Income Analyst. He writes about data manipulation, data exploration, visualization, and basic R plotting functions on his blog at http://datavisualizationineconomics.blogspot.com.
He has a master's degree in financial economics from the State University of New York (SUNY), Buffalo. He also graduated with a master of arts degree in economics from University of Pune, India. He loves to read blogs on data visualization and loves to go out on hikes in his free time.
This book would not have been possible without the help from numerous data visualizers and data scientists around the globe who bring into existence new and innovative ways to transform data into beautiful stories. I would like to sincerely thank the developers of R and R packages who have contributed so generously to the growing R open source community.
I would like to thank Jer Thorpe and Hans Rosling for their inspiring Ted videos on data visualization.
I would also like to thank all the economists and statisticians who have so often inspired me.
I would like to thank my publisher, Packt Publishing, for giving me the opportunity to work on this book. I would also like to thank all the technical reviewers and content development editors at Packt Publishing for their informative comments and suggestions.
Finally, I would like to thank my amazing family and magnificent friends for always encouraging and supporting me.
About the Reviewers
Sharan Kumar Ravindran is a lead data scientist in the fastest growing big data start-up based in Bangalore. His primary interests lie in statistics and machine learning. He has over 4 years of experience and has worked in the domains of e-commerce and IoT.
He has solved several problems on Kaggle and is among the top 10 percent of experts on Kaggle. His blog and social profiles can be found at www.rsharankumar.com.
He works for Flutura, which is ranked among the top 20 most promising big data companies across the globe by the leading analyst magazine, CIO Review. Flutura also featured on Gigaom reports on big data and M2M in the energy sector. Flutura was also the winner at TechSparks, where 800 innovative start-ups were evaluated.
Kannan Kalidasan is a software developer by profession, an autodidact, and open source evangelist. He has a decade's experience in database computing, data management, open source, and distributed computing. He holds a bachelor's of technology degree in computer science from Pondicherry University. He has played different roles in his career, such as a developer, an architect, a team lead, and a DBA. He currently holds the position of a BI Engineer at Orbitz Worldwide.
He started his own start-up back in 2005 on a part-time basis during his college days, worked with other companies in different open source projects, and provided training. He is passionate about technology and an entrepreneur at heart, and he likes to mentor fellow enthusiasts. His inherent curiosity keeps him occupied with learning new technologies and trying new things. He always believes that our dreams can be delayed but will never fail if we work hard.
He blogs at www.kannandreams.wordpress.com and you can follow him on Twitter at @kannanpoem. He loves to take long walks alone, write Tamil poems, paint, and read books.
A big thank you to all who believed in me and supported me. I would like to thank my strong soul for pushing me to achieve my dreams. I would like to express my deepest gratitude to Packt Publishing for giving me this opportunity.
Erik M. Rodríguez Pacheco works as a manager in the Business Intelligence Unit at Banco Improsa in San José, Costa Rica. He has 11 years of experience in the financial industry. He is currently a professor of the Business Intelligence Specialization Program at the Instituto Tecnológico de Costa Rica's Continuing Education Program. Erik is an enthusiast of new technologies, particularly those related to business intelligence, data mining, and data science. He holds a Bachelor's degree in business administration from Universidad de Costa Rica, and has specialized in business intelligence from the Instituto Tecnológico de Costa Rica, data mining from Promidat (Programa Iberoamericano de Formación en Minería de Datos), and business intelligence and data mining from Universidad del Bosque, Colombia. He is currently enrolled in a specialization program in data science from Johns Hopkins University. He can be reached at cr.linkedin.com/in/erikrodriguez.
Arun Padmanabhan has about 4 years of experience in developing products including mobile, enterprise, statistical, and data mining applications. He graduated with a master's degree in computer applications in 2010. Currently, he is a data scientist at Flutura Decision Science and Analytics, where he is working at saving the world, one data product at a time.
Juan Pablo Zamora holds a bachelor's degree in statistics from the University of Costa Rica (UCR) in 2007. He is currently working on his dissertation in the field of predictive analytics and will obtain an MSc degree in statistics from the University of Costa Rica.
He enjoys teaching and was a tutor of statistics courses at the Business School of UNED of Costa Rica during 2010-2012. He also mentored others in the areas of data processing and analytics as well as the use of statistical analysis tools, to name a few.
Juan has over 7 years of experience in the banking industry, primarily in the credit card business for Central America and Mexico. He began as an analyst, eventually becoming the leader of a team of analysts for Central America's largest credit card issuer and acquirer. During this period, he participated in several predictive analytics projects related to credit risk, account retention, and profitability.
Juan recently joined a large multinational company in the retail sector with the task of building an analytics program to identify and prevent high-risk issues and/or threats to the business in Latin America.
His current interests are R, data visualization, business intelligence, predictive modeling, and big data. He can be reached at cr.linkedin.com/in/datasciencezamora or data.
Patric Zhao is a senior GPU architect in the High Performance Computing (HPC) field at Nvidia. He has experience in developing scientific and engineering applications and focuses on parallelization, performance modeling, and architecture-specific tuning. Patric is currently working on big data and machine learning areas, including regression, neural network, recommending system design, and implementation in CPU and GPU architectures. Patric has also contributed to accelerate R's applications by CUDA in the GPU ecosystem. You can find related articles on Nvidia's blog at http://devblogs.nvidia.com/parallelforall/author/patricz/ or write to him at
I would like to really thank my wife Yan Li J for always supporting and encouraging me.
www.PacktPub.com
Support files, eBooks, discount offers, and more
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At