0

I'm wondering if the ggpairs() function can be set up to be as fast and flexible as pairs() (flexible in terms of coloring, I realize that a user can do a lot more with ggpairs but i'm more familiar with base r pairs()).

Here is a pairs example using the diamonds data set:

diamonds$zcolor <- character(nrow(diamonds))
above <- 0.7
below <- 0.6
diamonds$zcolor[diamonds[['carat']] < below] <- "#E74C3C"
diamonds$zcolor[diamonds[['carat']] <= above & diamonds[['carat']] >= below] <- "#F1C40F"
diamonds$zcolor[diamonds[['carat']] > above] <- "#2ECC71"
pairs(head(diamonds[,1:10], 1800), col = diamonds$zcolor)

Essentially, coloring the data depending on the value of carat. In the app i'm working on the user can set the thresholds(above & below) for different colors. I want to have the same functionality with ggpairs - to choose the color thresholds based on a slider. Even still, without coloring ggpairs seems to render much slower than regular pairs. Is there a way to remedy this?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • 1
    I think generally you are going to find `ggpairs` to be slow. If you are OK with the default color schemes, something like `ggpairs(head(diamonds, 1800), aes(color = zcolor), columns = 1:10)` will get you a plot. Changing the colors takes more work; see [here](http://stackoverflow.com/questions/34740210/how-to-change-the-color-palette-for-ggallyggpairs) for an option. – aosmith Aug 08 '16 at 22:57
  • Agreed. If there were an easy way to speed up `ggairs`, it would have been done long ago. – Gregor Thomas Aug 08 '16 at 23:01

0 Answers0