Unfortunately, I cannot see how that is possible. First, it's not going to work with gridExtra, since arrangeGrob operates on TableGrob objects: > ggplotGrob(qplot(1:100)) stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this. TableGrob (6 x 5) "layout": 8 grobs z cells name grob 1 0 (1-6,1-5)...
I hope there is an easier way to do this, but this is a sort of brute force approach. It does give you flexibility to easily customize the plots further however. The main point is using putPlot to put a ggplot2 plot into the figure. library(ggplot2) ## First create combinations...
Conceptually the same as @Mike's solution, but in one line. levels(iris$Species) <- c("set", "ver", "vir") ggplairs(<...>) Here's another, more flexible proposal if you have many levels and do not want to abbreviate them by hand: trim levels to a desired length. levels(iris$Species) <- strtrim(levels(iris$Species), 3) ggplairs(<...>) And by the way,...
You get the last error because qsec is not present in the subset c("mpg", "wt", "disp"). ggpairs(mtcars[ ,c("mpg", "wt", "disp", "qsec")], columns = 1:3, size = "qsec") ...
I don't know about being the best way, it's certainly not easier, but this generates three lists of plots: one each for the bar plots, the scatterplots, and the tiles. Using gtable functions, it creates a gtable layout, adds the plots to the layout, and follows up with a bit...
r,scatter-plot,ggally,r-corrplot
Short answer: There doesn't seem to be an elegant or easy way to do it, but here's a workaround. I dug into the ggpairs source code (in the GGally package source available from CRAN) to see how the variable labels are actually drawn. The relevant function in ggpairs.R is print.ggpairs....
As far as I can tell, ggparcoord drops columns from the data set it does not use. So if you want to use a variable in the facet that you did not reference in ggparcoord(), then you're going to have a problem. One work around is to modify the data...
r,colors,parallel-coordinates,ggally
You should be able to map the colour (darkgreen) to a corresponding factor level (green) by adding: + scale_colour_manual(values = c("green" = "darkgreen")) ...