Setting characteristics to plots in a Multipaneled Graph in r, using apply function

22 Views Asked by At

I am trying to obtain:

1: point characters of a same color per panel

2: a title for each panel, as it's vector's name. (norm, exp, ...)

set.seed(98)
random <- data.frame(cauchy = rcauchy(100       ),
                     norm   =   rnorm(100,sd=20 ),
                     exp    =    rexp(100, 1/15 ),
                     unif   =   runif(100,-40,60),
                     chisq  =  rchisq(100, 30   ),
                     weibull=rweibull(100, 0.5  ))
op2<- par(mfrow = c(2, 3), las =1, mar = c(0,0,0,0), oma = c(2,2,2,2), xpd =NA)
apply(random, MARGIN = 2, FUN = function (x) {plot(x, xlim =c(0,100), ylim =c(-40, 80), 
      xlab = "", ylab = "", xaxt = "n", yaxt = "n", main = names(x), col = c("red", "green", "blue", "lightblue", "pink", "yellow"))})

I get a panel with a rainbow of point characters, and no title.

0

There are 0 best solutions below