Data Vis: Margins Manipulations Flashcards

1
Q

margins in R

A

All plots in R have margins surrounding them that separate the main plotting space from the area where the axes, labels and additional text lie

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

par(mar = c(bottom, left, top, right)) function

A

First Plot with small margins

You can adjust the size of the margins by specifying a margin parameter

The default value for mar is c(5.1, 4.1, 4.1, 2.1). To change the size of the margins of a plot you must do so with par(mar) before you actually create the plot.

par(mar = c(2, 2, 2, 2)) # Set the margin on all sides to 2
plot(1:10)
mtext(“Small Margins”, side = 3, line = 1, cex = 1.2)
mtext(“par(mar = c(2, 2, 2, 2))”, side = 3)

par(mar = c(5, 5, 5, 5)) # Set the margin on all sides to 6
plot(1:10)
mtext(“Large Margins”, side = 3, line = 1, cex = 1.2)
mtext(“par(mar = c(5, 5, 5, 5))”, side = 3)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly