Graphics in R Flashcards
This is often conceptually simpler and allows plotting to mirror the thought process.
Base Graphics
This combines the concepts from both base and lattice graphics but uses an independent implementation.
ggplot2
In base graphics, we can see the history of a data by using what function?
hist
We use this function to make the data more appealing
colors
In plotting data, what function do we need to use?
plot
What is the syntax of plot?
plot(x = <x>, y = <y>)</y></x>
This code is used as a plotting symbol
pch
the line width, specified as an integer multiple
lwd
the plotting color,Specified as a number, string, or hex code.
col
character string for the x-axis.
xlab
character string for the y-axis.
ylab
This code is used for the line type (default as solid line).
lty
This function is used to specify global graphics parameters that affects all plots in an R session.
par
Number of plots per row (plots are filled row-wise)
mfrow
Number of plots per row(plots are filled column-wise)
mfcol
The background color
bg
The outer margin size
oma
The margin size
mar
the orientation of the axis labels on the plot
las
This function is similar to plot but with many built-in features.
qplot
This plot is for complex customization
ggplot
A great way to display categorical variables or discrete quantitative variables.
Bar chart
Components of a ggplot
Data frame, aesthetic mappings, geoms, facets, stats, scales, and coordinate system.
For conditional plots
facets
statistical transformation like binning, quantiles, smoothing
stats
what scale an aesthetic map uses?
scales
How data are mapped to color, size, etc.
Aesthetic mappings
Three layers on how plots are built.
Plot the data, overlay summary, metadata and annotation
This function is used in constructing aesthetic mappings.
aes
All ggplot2 plots begin with a call to ggplot(), supplying default data and
aesthethic mappings, specified by aes(). You then add layers, scales, coords and
facets with +.
Plot basics
plot title
main
number of breakpoints or can be a vector of breakpoints
breaks
Character vector specifying _____ to use. Defaults to ”point” if x and y
are specified, and ”histogram” if only x is specified. It accepts ”point”, ”line”,
”smooth”, ”boxplot”.
geom