10.7: Student Testimonial- Data Visualizations with R
- Page ID
- 180440
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
Download R, RStudio and Install a Plotting Package
Starting up ggplot
Input your data
ggplot Legend and Functions
Term | Definition |
---|---|
Data | Data you visualize and a set of outlines of how you want to make it look appealing (choice of colour, bolding, etc.). |
Layers | Layers are the statistical summaries of that data which will be represented by geometric objects, geoms for short, that show what you see on the plot: points, lines, polygons, and so forth. |
Scales | Scales show the ratio or proportion in which you have mapped your data onto your graphic. |
Coord | Coord stands for a coordinate system. The coordinate system describes where the data is shown on the plane of the graphic. It provides axes and gridlines to conceptualize the data onto space. A coordinate system, coord for short, describes how data coordinates are mapped to the plane of the graphic. It also provides axes and gridlines to make it possible to read the graph. |
Faceting | Faceting can break up the data into smaller subsets and make decisions about how to use these smaller groupings of data. |
Theme | The theme refers to choices of presentation such as colour or font. |
Source: Wilson, A. (2021). Driver’s of Dissidence: A Discourse Analysis of Vancouver’s Road to Ride-Hailing. Undergraduate Thesis. (p. 13). |
Term | Definition |
---|---|
Getting Started | Basic structure: ggplot(mpg, aes(x = displ, y = hwy) + |
Geom Functions | geom_smooth() fits a smoother to the data and displays the smooth and its standard error. |
Histograms and Frequency Polygons | ggplot(mpg, aes(hwy)) + geom_histogram() |
Bar Charts | geom_bar() |
Time Series with Line and Path Plots | ggplot(economics, aes(date, unemploy / pop)) + |
Source: Wickham, H. (2016). Getting started with ggplot2. ggplot2 (pp. 11-31). Springer International Publishing. https://doi.org/10.1007/978-3-319-24277-4_2 |