Does anyone know why pie charts shrink in size after a fourth row in R using the par function?

158 Views Asked by At

I created a plot with four rows and two columns of pie charts (one column is for cases and the other is for controls). Code is copied below. Once I go from par(mfrow= c(3,2)) to par(mfrow = c(4,2)), the pie charts shrink to a difficult-to-read size. If there are 1-3 rows, the pie charts are fine. Anyone have any solutions? Thanks all.

#Plot with Pie Chart
par(mfrow= c(4,2))
pie(A, col=colsA, labels=pielabelsA)
pie(B,col=colsB, labels=pielabelsB)
pie(C, col = colsA, labels = pielabelsC)
pie(D, col = colsB, labels = pielabelsD)
pie(E, col = colsE, labels = pielabelsE)
pie(F, col = colsF, labels = pielabelsF)
pie(G, col = colsG, labels = pielabelsG)
pie(H, col = colsH, labels = pielabelsH)


#Pie Chart Data
A <- c(255, 26)
percentlabelsA <- round(100*A/sum(A), 2)
pielabelsA <- paste(percentlabelsA, "%", sep="")
colsA <- c("blue", "yellow")

B <- c(374,10)
percentlabelsB <- round(100*B/sum(B), 2)
pielabelsB <- paste(percentlabelsB, "%", sep="")
colsB <- c("red", "yellow")


C <- c(231, 25)
percentlabelsC <- round(100*C/sum(C), 2)
pielabelsC<- paste(percentlabelsC, "%", sep="")
colsC <- c("blue", "yellow")

D <- c(504, 37)
percentlabelsD <- round(100*D/sum(D), 2)
pielabelsD<- paste(percentlabelsD, "%", sep="")
colsD <- c("red", "yellow")

E <- c(50, 2)
percentlabelsE <- round(100*E/sum(E), 2)
pielabelsE <- paste(percentlabelsE, "%", sep="")
colsE <- c("blue", "yellow")

F <- c(506,14)
percentlabelsF <- round(100*F/sum(F), 2)
pielabelsF <- paste(percentlabelsF, "%", sep="")
colsF <- c("red", "yellow")

G <- c(26, 1)
percentlabelsG <- round(100*G/sum(G), 2)
pielabelsG <- paste(percentlabelsG, "%", sep="")
colsG <- c("blue", "yellow")

H <- c(530,15)
percentlabelsH <- round(100*H/sum(H), 2)
pielabelsH <- paste(percentlabelsH, "%", sep="")
colsH <- c("red", "yellow")
0

There are 0 best solutions below