Control graphic parameters
In R, it is also possible to tailor the window layout using the par()
function.
To set up a graphical window for multiple charts with nr
rows and nc
columns, assign the vector c(nr, nc)
to the option mfrow
. To adjust the size of the margins and characters in the text, set the appropriate decimal value to to the options mex
and cex
, respectively. Like plot()
, each call to par()
only implements the parameters in that particular call.
Look at this example:
> # Create 3x1 graphical window
> par(mfrow = c(3, 1))
> # Also reduce margin and character sizes by half
> par(mfrow = c(2, 1), mex = 0.5, cex = 0.5)
After this, you would make two consecutive calls to plot()
to add the series in the order that you want them to appear.
It's time to practice! The dataset data
is loaded in your workspace.
Este ejercicio forma parte del curso
Visualizing Time Series Data in R
Instrucciones del ejercicio
- Create a 2x1 graphical window, then plot the first two series in
data
in that order, including the title for each of them - Reduce margin size to 60% and character size to 80% of their normal sizes and replot with same graphical window and titles
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# Plot two charts on same graphical window
# Replot with reduced margin and character sizes