How to add an external legend to ggpairs()?
问题 I am plotting a scatterplot matrix using ggpairs . I am using the following code: # Load required packages require(GGally) # Load datasets data(state) df <- data.frame(state.x77, State = state.name, Abbrev = state.abb, Region = state.region, Division = state.division ) # Create scatterplot matrix p <- ggpairs(df, # Columns to include in the matrix columns = c(3,5,6,7), # What to include above diagonal # list(continuous = "points") to mirror # "blank" to turn off upper = "blank", legends=T, #