Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove excess whitespace in R pie charts?

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?

like image 846
user1521655 Avatar asked Aug 24 '18 15:08

user1521655


1 Answers

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))
like image 103
Darren Tsai Avatar answered Oct 21 '22 00:10

Darren Tsai