3

I'm trying to create a matrix plot using GGally::ggpairs that just has scatterplots in the upper portion of the figure:

library(ggplot2)
library(GGally)

data(iris)
ggpairs(iris, columns = 1:4, diag = "blank",
    upper = list(continuous = wrap("points", colour = "#e0f3f8", size = 1)),
    lower = list(continuous = wrap("blank"))) +
    ggplot2::theme_dark()

Which gives

this output added.

The problem is I can't work out how to display the axis labels with the lower potion being blank. This answer explained how to remove elements but not add them back in. Other things I've tried:

axisLabels = "show" and showStrips = TRUE don't make a difference to the plot

axisLabels = "internal" moves the variable titles into the diagonal which I don't want. The text is also grey on a grey background, and axis.title.x = element_text(colour = "white") didn't fix that either.

Is there a way to have variable labels above the plots and axis labels below them, while keeping the plots in the upper half of the plot?

hpesoj626
  • 3,529
  • 1
  • 17
  • 25
Lucy Wheeler
  • 271
  • 3
  • 17
  • does this help https://stackoverflow.com/questions/42654928/how-to-show-only-the-lower-triangle-in-ggpairs – Richard Telford Mar 27 '18 at 15:54
  • 1
    @RichardTelford It works with the matrix plots in the lower portion of the plot, but not if they're in the upper portion (only shows petal length/sepal width in the top right hand corner). Is there a way I can modify the `gpairs_lower` function to take that into account? – Lucy Wheeler Mar 27 '18 at 16:09
  • Certainly possible to modify `gpairs_lower` to make `gpairs_upper`. – Richard Telford Mar 27 '18 at 16:26

0 Answers0