O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Applied Data Visualization with R and ggplot2

Book Description

Develop informative and aesthetic visualizations that enable effective data analysis in less time

Key Features

  • Discover structure of ggplot2, grammar of graphics, and geometric objects
  • Study how to design and implement visualization from scratch
  • Explore the advantages of using advanced plots

Book Description

Applied Data Visualization with R and ggplot2 introduces you to the world of data visualization by taking you through the basic features of ggplot2. To start with, you'll learn how to set up the R environment, followed by getting insights into the grammar of graphics and geometric objects before you explore the plotting techniques.

You'll discover what layers, scales, coordinates, and themes are, and study how you can use them to transform your data into aesthetical graphs. Once you've grasped the basics, you'll move on to studying simple plots such as histograms and advanced plots such as superimposing and density plots. You'll also get to grips with plotting trends, correlations, and statistical summaries.

By the end of this book, you'll have created data visualizations that will impress your clients.

What you will learn

  • Set up the R environment, RStudio, and understand structure of ggplot2
  • Distinguish variables and use best practices to visualize them
  • Change visualization defaults to reveal more information about data
  • Implement the grammar of graphics in ggplot2 such as scales and faceting
  • Build complex and aesthetic visualizations with ggplot2 analysis methods
  • Logically and systematically explore complex relationships
  • Compare variables in a single visual, with advanced plotting methods

Who this book is for

Applied Data Visualization with R and ggplot2 is for you if you are a professional working with data and R. This book is also for students who want to enhance their data analysis skills by adding informative and professional visualizations. It is assumed that you know basics of the R language and its commands and objects.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Applied Data Visualization with R and ggplot2
  3. About the Author
    1. About the Author
  4. Packt Upsell
    1. Why Subscribe?
    2. PacktPub.com
  5. Preface
    1. Who This Book Is For
    2. What This Book Covers
    3. To Get the Most out of This Book
      1. Download the Example Code Files
      2. Conventions Used
    4. Get in Touch
      1. Reviews
  6. Basic Plotting in ggplot2
    1. Introduction to ggplot2
      1. Similar Packages
      2. The RStudio Workspace
      3. Loading and Exploring a Dataset Using R Functions
      4. The Main Concepts of ggplot2
        1. Types of Variables
      5. Exploring Datasets
        1. Making Your First Plot
      6. Plotting with qplot and R
        1. Analysis
    2. Geometric Objects
      1. Analyzing Different Datasets
      2. Histograms
      3. Creating a Histogram Using qplot and ggplot
      4. Activity: Creating a Histogram and Explaining its Features
      5. Creating Bar Charts
      6. Creating a One-Dimensional Bar Chart
      7. Creating a Two-Dimensional Bar Chart
      8. Analyzing and Creating Boxplots
      9. Creating a Boxplot for a Given Dataset
        1. Scatter Plots
        2. Line Charts
      10. Creating a Line Chart
      11. Activity: Creating One- and Two-Dimensional Visualizations with a Given Dataset
      12. One-Dimensional Plots
      13. Two-Dimensional Plots
      14. Three-Dimensional Plots
    3. The Grammar of Graphics
      1. Rebinning
      2. Analyzing Various Histograms
      3. Changing Boxplot Defaults Using the Grammar of Graphics
      4. Activity: Improving the Default Visualization
    4. Summary
  7. Grammar of Graphics and Visual Components
    1. More on the Grammar of Graphics
      1. Layers
      2. Using More Layers to Customize a Histogram
      3. Scales
      4. Using Scales to Analyze a Dataset
        1. Types of Coordinates
      5. Understanding Polar Coordinates
      6. Activity: Applying the Grammar of Graphics to Create a Complex Visualization
    2. Facets
      1. Using Facets to Split Data
      2. Activity: Using Faceting to Understand Data
    3. Changing Styles and Colors
      1. Using Different Colors to Group Points by a Variable
      2. Activity: Using Color Differentiation in Plots
        1. Themes and Changing the Appearance of Graphs
      3. Using a Theme to Customize a Plot
        1. Analysis
      4. Using or Setting Your Own Theme Globally
      5. Changing the Color Scheme of the Given Theme
      6. Activity: Using Themes and Color Differentiation in a Plot
    4. Geoms and Statistical Summaries
      1. Using Grouping to Create a Summarized Plot
    5. Summary
  8. Advanced Geoms and Statistics
    1. Advanced Plotting Techniques
      1. Creating a Bubble Chart
      2. Density Plots
      3. Using Density Plots
      4. Superimposing Plots
      5. Using Density Plots to Compare Distributions
      6. Time Series
      7. Creating a Time Series Plot
      8. Explanation of the Code
      9. Activity: Plot the Monthly Closing Stock Prices and the Mean Values
    2. Maps
      1. Displaying Information with Maps
      2. Activity: Creating a Variable-Encoded Regional Map
      3. Trends, Correlations, and Statistical Summaries
      4. Creating a Time Series Plot with the Mean, Median, and Quantiles
      5. Trends, Correlations, and Scatter plots
      6. Creating a Scatter Plot and Fitting a Linear Regression Model
      7. Creating a Correlation Plot
      8. Activity: Studying Correlated Variables
    3. Summary
  9. Solutions
    1. Chapter 1:  Basic Plotting in ggplot2
      1. Activity: Creating a Histogram and Explaining its Features
      2. Activity: Creating One- and Two-Dimensional Visualizations with a Given Dataset
      3. Activity: Improving the Default Visualization
    2. Chapter 2:  Grammar of Graphics and Visual Components
      1. Activity: Applying Grammar of Graphics to Create a Complex Visualization
      2. Activity: Using Faceting to Understand Data
      3. Activity: Using Color Differentiation in Plots
      4. Activity: Using Themes and Color Differentiation in a Plot
    3. Chapter 3:  Advanced Geoms and Statistics
      1. Activity: Using Density Plots to Compare Distributions
      2. Activity: Plot the Monthly Closing Stock Prices and the Mean Values
      3. Activity: Creating a Variable-Encoded Regional Map
      4. Activity: Studying Correlated Variables
  10. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think