Remove excess whitespace in R pie charts?
Asked Answered
M

1

6

Is there any way to reduce the amount of whitespace around pie charts generated using the base plotting tools in R?

I'd like to create a multi-panel figure but I can't figure out a way to reduce the amount of whitespace around the plot.

Example code:

par(mfrow=c(2,1))
pie(1:5)
pie(rep(1,5))

I tried playing with mar, omi, and oma within par(), but all values for those vectors seem to already be set to zero, and negative values are not accepted. Any way around this?

Makepeace answered 24/8, 2018 at 15:7 Comment(0)
S
6

Graphical Parameters about the margin size of plots:

  • mai: the margin size in inches
  • mar: the margin size in lines of text
  • omi: the size of the outer margins in inches
  • oma: the size of the outer margins in lines of text

All above are specified with a numerical vector of the form c(bottom, left, top, right).


The default value of mai is :

> par("mai")
[1] 1.02 0.82 0.82 0.42

You can reset it as:

> par(mfrow = c(2, 1), mai = c(0, 0, 0, 0))
Salpingotomy answered 24/8, 2018 at 15:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.