ggally

How to change the color palette for GGally::ggpairs?

自闭症网瘾萝莉.ら 提交于 2019-12-05 06:48:59
This is the same question as in User defined colour palette in R and ggpairs or is there a way to change the color palette for GGally::ggpairs using ggplot? only that the solutions there don't work anymore. I also want to change the color palette, but is there a way to change the color palette for GGally::ggpairs using ggplot? does not work anymore. What to do? MWE: library(GGally) library(ggplot2) data(diamonds, package="ggplot2") diamonds.samp <- diamonds[sample(1:dim(diamonds)[1],200),] ggpairs( diamonds.samp[,1:2], mapping = ggplot2::aes(color = cut), upper = list(continuous = wrap(

incorporate standalone legend in ggpairs (take 2)

房东的猫 提交于 2019-12-05 05:37:59
tl;dr can't get a standalone legend (describing common colours across the whole plot) in ggpairs to my satisfaction. Sorry for length. I'm trying to draw a (lower-triangular) pairs plot using GGally::ggpairs (an extension package for drawing various kinds of plot matrices with ggplot2 ). This is essentially the same question as How to add an external legend to ggpairs()? , but I'm not satisfied with the answer to that question aesthetically, so I'm posting this as an extension (if suggested/recommended by commenters, I will delete this question and offer a bounty on that question instead). In

What´s the best way to do a correlation-matrix plot like this?

丶灬走出姿态 提交于 2019-12-04 20:55:27
问题 I used ggpairs to generate this plot: And this is the code for it: #load packages library("ggplot2") library("GGally") library("plyr") library("dplyr") library("reshape2") library("tidyr") #generate example data dat <- data.frame(replicate(6, sample(1:5, 100, replace=TRUE))) dat[,1]<-as.numeric(dat[,1]) dat[,2]<-as.numeric(dat[,2]) dat[,3]<-as.numeric(dat[,3]) dat[,4]<-as.numeric(dat[,4]) dat[,5]<-as.numeric(dat[,5]) dat[,6]<-as.numeric(dat[,6]) #ggpairs-plot main<-ggpairs(data=dat, lower

How to plot parallel coordinates with multiple categorical variables in R

天涯浪子 提交于 2019-12-04 03:21:39
I am facing a difficulty while plotting a parallel coordinates plot using the ggparcoord from the GGally package. As there are two categorical variables, what I want to show in the visualisation is like the image below. I've found that in ggparcoord , groupColumn is only allowed to a single variable to group (colour) by, and surely I can use showPoints to mark the values on the axes, but i also need to vary the shape of these markers according to the categorical variables. Is there other package that can help me to realise my idea? Any response will be appreciated! Thanks! It's not that

dplyr masks GGally and breaks ggparcoord

╄→гoц情女王★ 提交于 2019-12-04 02:56:49
Given a fresh session, executing a small ggparcoord(.) example provided in the documentation of the function library(GGally) data(diamonds, package="ggplot2") diamonds.samp <- diamonds[sample(1:dim(diamonds)[1], 100), ] ggparcoord(data = diamonds.samp, columns = c(1, 5:10)) results into the following plot: Again, starting in a fresh session and executing the same script with the loaded dplyr library(GGally) library(dplyr) data(diamonds, package="ggplot2") diamonds.samp <- diamonds[sample(1:dim(diamonds)[1], 100), ] ggparcoord(data = diamonds.samp, columns = c(1, 5:10)) results in: Error: (list

Legend using ggpairs

一曲冷凌霜 提交于 2019-12-03 21:47:35
Trying to follow an example made here, I was reproducing 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, # What to include below diagonal lower = list(continuous = "points"), # What to include in the diagonal diag =

What´s the best way to do a correlation-matrix plot like this?

南楼画角 提交于 2019-12-03 14:40:19
I used ggpairs to generate this plot: And this is the code for it: #load packages library("ggplot2") library("GGally") library("plyr") library("dplyr") library("reshape2") library("tidyr") #generate example data dat <- data.frame(replicate(6, sample(1:5, 100, replace=TRUE))) dat[,1]<-as.numeric(dat[,1]) dat[,2]<-as.numeric(dat[,2]) dat[,3]<-as.numeric(dat[,3]) dat[,4]<-as.numeric(dat[,4]) dat[,5]<-as.numeric(dat[,5]) dat[,6]<-as.numeric(dat[,6]) #ggpairs-plot main<-ggpairs(data=dat, lower=list(continuous="smooth", params=c(colour="blue")), diag=list(continuous="bar", params=c(colour="blue")),

Manipulating axis titles in ggpairs (GGally)

情到浓时终转凉″ 提交于 2019-12-03 04:22:19
问题 I'm using the code below to generate the following chart. # Setup data(airquality) # Device start png(filename = "example.png", units = "cm", width = 20, height = 14, res = 300) # Define chart pairs.chrt <- ggpairs(airquality, lower = list(continuous = "smooth"), diag = list(continuous = "blank"), upper = list(continuous = "blank")) + theme(legend.position = "none", panel.grid.major = element_blank(), axis.ticks = element_blank(), axis.title.x = element_text(angle = 180, vjust = 1, color =

GGally - unexpected behavior with ggpairs(…, diag = list( continuous = 'density'))

爷,独闯天下 提交于 2019-12-03 02:51:00
I am trying to generate a scatterplot matrix with density plots in the diagonals (using ggplot, preferably). The documentation for ggpairs in the GGally package states: diag is a list that may only contain the variables 'continuous' and 'discrete'. Each element of the diag list is a string implementing the following options: continuous = exactly one of ('density', 'bar', 'blank'); discrete = exactly one of ('bar', 'blank'). which suggests(??) that this should be possible using diag=list(continuous="density") . But the following code: xx <- mtcars[,c(1,3,4,6)] ## extract mpg, disp, hp, and wt

Manipulating axis titles in ggpairs (GGally)

折月煮酒 提交于 2019-12-02 17:46:50
I'm using the code below to generate the following chart. # Setup data(airquality) # Device start png(filename = "example.png", units = "cm", width = 20, height = 14, res = 300) # Define chart pairs.chrt <- ggpairs(airquality, lower = list(continuous = "smooth"), diag = list(continuous = "blank"), upper = list(continuous = "blank")) + theme(legend.position = "none", panel.grid.major = element_blank(), axis.ticks = element_blank(), axis.title.x = element_text(angle = 180, vjust = 1, color = "black"), panel.border = element_rect(fill = NA)) # Device off and print print(pairs.chrt) dev.off() I'm