Reputation: 2614
How does one get rid of white space when plotting in R as in the example below?
I would like to do this because when I want to multiple plots on a page it looks terrible.
I'm using the par function in the following way:
par(mfrow=c(5,3),mai=rep(0,4), omi=rep(0,4))
pie3D(c(4,2,2,3,6,3),main="example")
pie3D(c(4,2,2,3,6,3),main="example")
...
pie3D(c(4,2,2,3,6,3),main="example") #do this 15 times. In my real work, it's 15 different pie charts.
Which gives:
Upvotes: 3
Views: 2016
Reputation: 2289
Complementing the response of the previous friend can change the size of the pie with radius and reduce the white space.
library("plotrix")
par(mfrow=c(5,3))
for (i in 1:15){pie3D(c(4,2,2,3,6,3),radius = 2,main="example", mar=c(0,0,1,0))}
Upvotes: 0
Reputation: 13372
The problem is that pie3D
overwrites your margins to c(4,4,4,4)
.
You can set margins in ?pie3D
:
library("plotrix")
par(mfrow=c(5,3))
for (i in 1:15) pie3D(c(4,2,2,3,6,3),main="example", mar=c(0,0,1,0))
Upvotes: 4