2021-05-31

Using same X and Y axis for all par() plots

I have a loop generating 15 plots, one for each of my factor variables. This is my first time using par() to set up the plot space (I usually use ggplot or lattice, which I probably should have done here). Anyway, I'm generally okay with this, but I would like each graph to have the same X and Y range (1,5) and (0,120), respectively. I've read the par documentation but haven't figured out how to accomplish this. Here is my code:

par(mar=c(2,2,2,2),mfrow = c(4, 4))
for (i in 2:16) {
  plot(df[,i], main=colnames(df)[i],
       ylab = "Count", col="steelblue", las = 2)
}

Thank you!



from Recent Questions - Stack Overflow https://ift.tt/2SBiN9T
https://ift.tt/eA8V8J

No comments:

Post a Comment