Skip to content

Update 12-plottting2.Rmd #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 12-plottting2.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ All plots in R have margins surrounding them that separate the main plotting spa

You can adjust the size of the margins by specifying a margin parameter using the syntax `par(mar = c(bottom, left, top, right))`, where the arguments `bottom`, `left` ... are the size of the margins. 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.

Let's see how this works by creating two plots with different margins:In the plot on the left, I'll set the margins to 3 on all sides. In the plot on the right, I'll set the margins to 6 on all sides.
Let's see how this works by creating two plots with different margins:In the plot on the left, I'll set the margins to 2 on all sides. In the plot on the right, I'll set the margins to 5 on all sides.

```{r eval = FALSE}
# First Plot with small margins
Expand All @@ -228,7 +228,7 @@ mtext("Small Margins", side = 3, line = 1, cex = 1.2)
mtext("par(mar = c(2, 2, 2, 2))", side = 3)

# Second Plot with large margins
par(mar = c(5, 5, 5, 5)) # Set the margin on all sides to 6
par(mar = c(5, 5, 5, 5)) # Set the margin on all sides to 5
plot(1:10)
mtext("Large Margins", side = 3, line = 1, cex = 1.2)
mtext("par(mar = c(5, 5, 5, 5))", side = 3)
Expand All @@ -245,7 +245,7 @@ mtext("Small Margins", side = 3, line = 1, cex = 1.2)
mtext("par(mar = c(2, 2, 2, 2))", side = 3)

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