Introduction to R

Plotting With Base R Graphics

Jason Freels

27 September 2016

PRESENTATION OVERVIEW

In this presentation...

R has three MAIN plotting paradigms

Other packages extend R for specific types of plots

More helpful plotting resources

CREATING PLOTS IN BASE R GRAPHICS WITH plot(x, y,...)

When the plot(x, y,...) function is executed

Plotting Shiny App

\[ \begin{aligned} \binom{n}{k} &= \frac{n!}{k! \, (n - k)!}\\\\ \binom{50}{10} &= \frac{50!}{10! \, 40!} =1.0272278\times 10^{10} \;\text{possible samples} \end{aligned} \]

Adding Objects To An Active Plot Device

After the plot(x, y,...) function runs

Changing The Global Plot Settings With par(...)

Recall what happens when plot(x, y,...) is executed...

There are also global plot settings

Plotting Complex Objects And Special Plot Functions

plot(x, y,...) can be used to display much more than just sets of points


Several "wrapper" functions use plot(x, y,...) to create special purpose plots

- `plot.function( )` example: `curve(sin, -2*pi, 2*pi, xname = "t")`