[R] GGally ggpairs function parameters

Ion Marqués imarques at nemsolutions.com
Mon Jan 2 16:12:00 CET 2017

Hello R community,

I am trying to specify the input data in the upper, diag and/or lower
parameters of the ggpair function (GGally package). The dummy example
below adds two parameters to ggally_points, a data subsample and an
alpha value. However, the results show that the alpha is taken into
account but all the data is plotted, not just the three random points.

  myData <- data.frame(x = c(1,2,3,4,5,6), y = c(7,8,9,9,8,7), z =
  ggpairs(myData, aes(colour = z), columns = 1:2,
          upper = list(continuous = wrap(ggally_cor, size = 10)),
          diag = list(continuous = wrap(ggally_densityDiag, alpha = 0.6)),
          lower = list(continuous = wrap(ggally_points, data =
sample_n(myData, 3), alpha = 0.6)))

I have tried passing the data parameter as a list with wrapp, defining
the modified ggally_points outside, but the result is the same. I have
also unsuccessfully tried to modify the mapping = aes(...) parameter.
What am I missing here?

Thank you!

Ion Marqués

More information about the R-help mailing list