ggally

ggpairs plot with heatmap of correlation values with significance stars and custom theme

别等时光非礼了梦想. 提交于 2020-06-13 05:54:20
问题 I would like to create a correlation plot with ggPairs() which should contain a heat map of correlation values (as in this SO question) significance stars for the correlation (as in this SO question) font type and font size according to a custom theme. Based on the excellent solutions provided by @user20650 to the above mentioned SO questions, I succeeded in building a function to generate a heatmap of correlation values with significance stars. Unfortunately, when adding the (custom) theme,

Change axis labels of a modified ggpairs plot (heatmap of correlation)

六月ゝ 毕业季﹏ 提交于 2020-04-16 03:57:06
问题 I wanted to combine a ggpairs plot with a heatmap and found a wonderful solution: ggpairs plot with heatmap of correlation values #library library(GGally) library(ggplot2) #data sample_df <- data.frame(replicate(7,sample(0:5000,100))) colnames(sample_df) <- c("KUM", "MHP", "WEB", "OSH", "JAC", "WSW", "gaugings") #function for heatmap my_fn <- function(data, mapping, method="p", use="pairwise", ...){ # grab data x <- eval_data_col(data, mapping$x) y <- eval_data_col(data, mapping$y) #

ggpairs: adjusting axis labels to show minimum and maximum only

故事扮演 提交于 2020-01-02 09:56:14
问题 I want to show just the minimum and maximum values for all the axes of a ggpairs {GGally} plot. Find below a reproducible example df=as.data.frame(matrix(1:1000,nrow = 100)) ggpairs(df) I know I can do it individually by using breaks , but I don't know how can I apply this in ggpairs . Can somebody help me? 来源: https://stackoverflow.com/questions/45764317/ggpairs-adjusting-axis-labels-to-show-minimum-and-maximum-only

ggpairs: adjusting axis labels to show minimum and maximum only

╄→гoц情女王★ 提交于 2020-01-02 09:56:10
问题 I want to show just the minimum and maximum values for all the axes of a ggpairs {GGally} plot. Find below a reproducible example df=as.data.frame(matrix(1:1000,nrow = 100)) ggpairs(df) I know I can do it individually by using breaks , but I don't know how can I apply this in ggpairs . Can somebody help me? 来源: https://stackoverflow.com/questions/45764317/ggpairs-adjusting-axis-labels-to-show-minimum-and-maximum-only

Create a ggplot2 survival curve with censored table

笑着哭i 提交于 2019-12-31 06:50:30
问题 I am trying to create a Kaplan-Meier plot with 95% confidence bands plus having the censored data in a table beneath it. I can create the plot, but not the table. I get the error message: Error in grid.draw(both) : object 'both' not found. library(survival) library(ggplot2) library(GGally) library(gtable) data(lung) sf.sex <- survfit(Surv(time, status) ~ sex, data = lung) pl.sex <- ggsurv(sf.sex) + geom_ribbon(aes(ymin=low,ymax=up,fill=group),alpha=0.3) + guides(fill=guide_legend("sex")) pl

Create a ggplot2 survival curve with censored table

与世无争的帅哥 提交于 2019-12-31 06:50:27
问题 I am trying to create a Kaplan-Meier plot with 95% confidence bands plus having the censored data in a table beneath it. I can create the plot, but not the table. I get the error message: Error in grid.draw(both) : object 'both' not found. library(survival) library(ggplot2) library(GGally) library(gtable) data(lung) sf.sex <- survfit(Surv(time, status) ~ sex, data = lung) pl.sex <- ggsurv(sf.sex) + geom_ribbon(aes(ymin=low,ymax=up,fill=group),alpha=0.3) + guides(fill=guide_legend("sex")) pl

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

非 Y 不嫁゛ 提交于 2019-12-20 12:32:21
问题 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

ggpairs plot with heatmap of correlation values

霸气de小男生 提交于 2019-12-19 07:44:08
问题 My question is twofold; I have a ggpairs plot with the default upper = list(continuous = cor) and I would like to colour the tiles by correlation values (exactly like what ggcorr does). I have this: I would like the correlation values of the plot above to be coloured like this: library(GGally) sample_df <- data.frame(replicate(7,sample(0:5000,100))) colnames(sample_df) <- c("KUM", "MHP", "WEB", "OSH", "JAC", "WSW", "gaugings") ggpairs(sample_df, lower = list(continuous = "smooth")) ggcorr

Edit individual ggplots in GGally::ggpairs: How do I have the density plot not filled in ggpairs?

﹥>﹥吖頭↗ 提交于 2019-12-18 04:16:07
问题 With library(GGally) data(diamonds, package="ggplot2") diamonds.samp <- diamonds[sample(1:dim(diamonds)[1],200),] # Custom Example ggpairs( diamonds.samp[,1:5], mapping = ggplot2::aes(color = cut), upper = list(continuous = wrap("density", alpha = 0.5), combo = "box"), lower = list(continuous = wrap("points", alpha = 0.3), combo = wrap("dot", alpha = 0.4)), diag = list(continuous = wrap("densityDiag")), title = "Diamonds" ) I get How do I make the diagonal density plots to not be filled, and

Arranging GGally plots with gridExtra?

荒凉一梦 提交于 2019-12-17 20:54:52
问题 I'd like to arrange my ggpairs plots with arrangeGrob : library(GGally) library(gridExtra) df <- structure(list(var1 = 1:5, var2 = 4:8, var3 = 6:10), .Names = c("var1", "var2", "var3"), row.names = c(NA, -5L), class = "data.frame") p1 <- ggpairs(df, 1:3) p2 <- ggpairs(df, 1:2) p <- arrangeGrob(p1, p2, ncol=2) which results in this error: Error in arrangeGrob(p1, p2, ncol = 2) : input must be grobs! Is there a way to work around this problem? 回答1: Unfortunately, I cannot see how that is