0% found this document useful (0 votes)
146 views

Data Visualization With Ggplot2 PDF

This document introduces ggplot2, a data visualization package in R. It discusses that the tutorial will focus on using ggplot2 to visualize an H1B visa dataset. It explains that ggplot2 uses a grammar of data, layers, scales, coordinates, faceting, and themes to create visualizations. Each ggplot2 graph has three core components - data, aesthetics to map the data, and at least one layer to render the visualization. The document recommends Hadley Wickham's book as a resource for learning ggplot2. It concludes by inviting questions.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views

Data Visualization With Ggplot2 PDF

This document introduces ggplot2, a data visualization package in R. It discusses that the tutorial will focus on using ggplot2 to visualize an H1B visa dataset. It explains that ggplot2 uses a grammar of data, layers, scales, coordinates, faceting, and themes to create visualizations. Each ggplot2 graph has three core components - data, aesthetics to map the data, and at least one layer to render the visualization. The document recommends Hadley Wickham's book as a resource for learning ggplot2. It concludes by inviting questions.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Introduction to ggplot2

Data Visualization with ggplot2


Data Visualization with ggplot2

About Arham Akheel


• Business Analyst at Data Science Dojo
• Started journey in Data Science last year after a
career in engineering.
• Masters in Technology Management.
• Data enthusiast, enjoys data sleuthing.
Data Visualization with ggplot2

Expectations
• You are experienced with R coding.

• You have some data visualization knowledge.

• You are interested to improve your data


visualization skills with ggplot2.

• Focus will be on the 20% that is useful 80% of the


time.
Data Visualization with ggplot2

Prerequisites
• Install R & RStudio

• Install ggplot2 package on your R environment.

• The repository on GitHub has files for the source,


data and slides.
URL: https://github.com/datasciencedojo/tutorials
Data Visualization with ggplot2

The Data

Why this dataset?


• Everyone is familiar with the problem domain.
• It is a good proxy for common business data – for example,
customer profile data.
Data Visualization with ggplot2

The Data
• H1B data from U.S. Department of Labor for 2018.
Data Visualization with ggplot2

ggplot2
• Standard visualization package in R

• Designed for print-quality graphics


in seconds.

• Fine-grained control via an API for


layering graphical elements to build
visualizations.
Data Visualization with ggplot2

The Grammar
Every visualization in ggplot2 is composed of the following:
▪ Data – The raw material of your visualization.
▪ Layers – What you see on the plots (e.g., points, lines etc.).
▪ Scales – Maps the data to graphical output
▪ Coordinates – The visualization’s perspective (e.g., a grid).
▪ Faceting – Provides “visual drill-down’ into the data.
▪ Themes – Controls the details of the display (e.g., fonts).
Data Visualization with ggplot2

Working with the Grammar


While ggplot2 is designed with a rich grammar, using ggplot2 in
practice is quite simple. Each ggplot2 visualization has three
required components:
▪ Data – The raw material of your visualization.

▪ Aesthetics – The mappings of your data to the visualization.

▪ Layers – A visualization requires at least once layer to render the data and aesthetics
to the screen. These layers typically take the form of a ggplot2 geom function – for
example, a simple scatter plot.
Data Visualization with ggplot2

ggplot2 – The Book


• Resource for learning ggplot2.

• Written by the author of the


ggplot2 package!

• Excellent introductory resource –


good for all skill/experience levels.
Data Visualization with ggplot2

R CODE!
Data Visualization with ggplot2

QUESTIONS
Data Visualization with ggplot2

THANK YOU!

Want More?
• Follow us on Facebook, Twitter, & LinkedIn
• More tutorials available on
https://tutorials.datasciencedojo.com/.
• Hear what our students say about our bootcamp on
https://datasciencedojo.com/bootcamp/reviews/

You might also like