Introducing ggplot2 - Data Visualization in R with ggplot2 Video Tutorial | LinkedIn Learning, formerly Lynda.com (2024)

From the course: Data Visualization in R with ggplot2

From the course: Data Visualization in R with ggplot2

Start my 1-month free trial

Introducing ggplot2

- [Instructor] Ggplot2 is the most popular and fully-featured data visualization package for the R programming language. The power of ggplot2 comes from the fact that it allows you to build and customize graphics in exactly the manner you'd like them to appear using a concept known as the grammar of graphics. If you've ever struggled with creating a visualization in Excel because you couldn't figure out how to tweak the graphic to appear exactly the way you'd like, ggplot2 is for you. Ggplot2 allows you to easily create simple visualizations while also permitting you to define the precise details of a visualization as specifically as you'd like. Ggplot2 is part of a collection of R packages designed for data analysis, known as the tidyverse. Curated by Hadley Wickham, the Chief Scientist at RStudio, the tidyverse packages provide R developers with a set of tools that follow the entire data analysis lifecycle. Let's talk briefly about a few of the components of the tidyverse and how they fit into the data analysis lifecycle. The readr package contains a set of functions designed to import data into R in various forms. In this course, we'll use the read_csv function from the readr package to read data files consisting of comma-separated values, but readr has a lot more available to help you handle tab-separated files, Excel files, and other common data formats. The tibble package defines a new data structure called the tibble that makes it easy to manipulate data in R. The tibble replaces the data frame structure used in Base R, providing a similar data structure that's simpler to work with. The dplyr package contains a set of functions to help you with data manipulation. You'll find functions that select the variables you'd like to include in your analysis, filter the rows included in a tibble, sort data, create new variables, and summarize values using aggregate functions. The tidyr package provides functions that help you create tidy datasets by making wide datasets long with the gather function and making long datasets wide with the spread function. You can learn more about these tidyverse packages in my course, Data Wrangling in R, but what we're most concerned about in this course is the ggplot2 package. Ggplot2 is a set of functions that implement the grammar of graphics and allow you to visualize your data using scatterplots, bar and column graphs, lines, and basically another other type of visualization that you can imagine. Ggplot2 is especially powerful because it is integrated with all of the other components of the tidyverse. You can read data in using the readr package, manipulate it with dplyr and tidyr, and then visualize it with ggplot2. All of your data passes easily between packages because they're designed to be compatible. You'll see that when we get into some examples later in this course. It's easy to install ggplot2. While you can install this package alone, the easiest way to install it is to simply install the entire tidyverse all at once. You can do that by issuing a single command in the R console. Just type install.packages, and then insides of double quotes, put the word tidyverse. When you hit Enter, R will go ahead and begin the installation process. It tells you a lot about all the various packages and dependencies that it needs to load to get the tidyverse set up. This will take a few minutes depending upon what packages are already installed on your computer and the current version of those packages. Once this finishes, you now have the entire tidyverse installed on your system and ready to use. When you're inside of an R script, you can simply issue the command library(tidyverse) to go ahead and load the tidyverse into memory and make it accessible to your code. When you load the tidyverse, you will see some error messages about conflicts between packages in the tidyverse and packages that are already installed on your system. This is normal and it's okay. Now that you've installed the tidyverse, you're ready to begin creating some visualizations.

Contents

    • Welcome 47s
    • What you need to know 1m 7s
    • Using the exercise files 1m 26s
    • Introducing ggplot2 4m 43s
    • The grammar of graphics 4m 54s
    • Loading data sets with read_csv 9m 2s
    • Build your first visualization 3m
    • Scatterplots 6m 57s
    • Lines and smoothers 6m 35s
    • Bars and columns 4m 57s
    • Histograms 4m 31s
    • Box plots 4m 14s
    • Modifying the background 6m 12s
    • Working with axes 4m 49s
    • Changing scales 4m 56s
    • Cleaning up legends 4m 56s
    • Annotating your visualization 9m 54s
    • Adding titles 1m 59s
    • Using themes 4m 3s
    • Visualizing data with maps 2m 38s
    • Obtaining a Google Maps API key 6m 58s
    • Working with maps 3m 27s
    • Geocoding points 4m 37s
    • Changing map types 4m 18s
    • Plotting points on a map 6m 42s
    • Building a map manually 5m 37s
    • Creating a choropleth map 9m 16s
    • Challenge assignment 47s
    • Mapping colleges and universities 2m 17s
    • Adding institution size and control 1m 52s
    • Zooming in on California 3m 12s
    • Adding city names 2m 47s
    • Cleaning the legends 1m 59s
    • Adding a title and subtitle 57s
    • What's next? 56s
Introducing ggplot2 - Data Visualization in R with ggplot2 Video Tutorial | LinkedIn Learning, formerly Lynda.com (2024)

References

Top Articles
Latest Posts
Article information

Author: Jonah Leffler

Last Updated:

Views: 6726

Rating: 4.4 / 5 (45 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Jonah Leffler

Birthday: 1997-10-27

Address: 8987 Kieth Ports, Luettgenland, CT 54657-9808

Phone: +2611128251586

Job: Mining Supervisor

Hobby: Worldbuilding, Electronics, Amateur radio, Skiing, Cycling, Jogging, Taxidermy

Introduction: My name is Jonah Leffler, I am a determined, faithful, outstanding, inexpensive, cheerful, determined, smiling person who loves writing and wants to share my knowledge and understanding with you.