r-corrplot

R: using corrplot to visualize two variables (e.g., correlation and p-value) using the size and colour of the circles

ε祈祈猫儿з 提交于 2021-02-19 02:24:28
问题 I am trying to recreate someone's image using corrplot. This is the original image I am trying to re-create: I use the following R-code: corrplot(as.matrix(rgs), method="circle", type="upper", col=brewer.pal(n=8, name="PuOr"), tl.col="black", tl.srt=45, p.mat = as.matrix(pvalues), sig.level = 0.05, insig = "blank") Which gives me this: The problem I have is that the colour as well as the size of the circles in my plot are based on the correlations, but in the original image above the colour

Dendrogram with Corrplot (R)

好久不见. 提交于 2021-02-09 11:42:19
问题 Does anyone have a method to adorn an R corrplot correlation plot with a dendrogram? 回答1: The closest solution I know of is to use a heatmap on a correlation matrix, for example you could also use gplots::heatmap.2. Here is how to do it using the heatmaply R package, which also offers an interactive interface where you can zoom-in and get a tooltip when hovering over the cells: # for the first time: # install.packages("heatmaply") library(heatmaply) my_cor <- cor(mtcars) heatmaply_cor(my_cor)

Dendrogram with Corrplot (R)

左心房为你撑大大i 提交于 2021-02-09 11:41:10
问题 Does anyone have a method to adorn an R corrplot correlation plot with a dendrogram? 回答1: The closest solution I know of is to use a heatmap on a correlation matrix, for example you could also use gplots::heatmap.2. Here is how to do it using the heatmaply R package, which also offers an interactive interface where you can zoom-in and get a tooltip when hovering over the cells: # for the first time: # install.packages("heatmaply") library(heatmaply) my_cor <- cor(mtcars) heatmaply_cor(my_cor)

Converting corrplot output to grob

痞子三分冷 提交于 2021-01-28 03:27:40
问题 I am trying to use grid.arrange to combine multiple types of graph/table, one of which is a correlation matrix using corrplot . Is there a way to convert a corrplot to a grob or export/import as an image compatible with grid.arrange ? Since the other plots I'm combining are from ggplot and tableGrob, I can't seem to use par(mfrow = c(2, 2)) or layout(matrix(1:2)) as suggested in other posts. P1 <- corrplot(PANAcor, order="hclust", addgrid.col = "gray", type="full", col = col2(50), tl.cex=1.5,

How to use corrplot with simple matrices

你说的曾经没有我的故事 提交于 2020-07-05 07:56:10
问题 I have a simple 8 by 8 matrix M <- matrix(rnorm(64), nrow=8, ncol=8) How should I transform it to plot it with library(corrplot) ? Without transformation the error is: corrplot.mixed(M) Error in corrplot(corr, type = "upper", method = upper, diag = TRUE, tl.pos = tl.pos, : The matrix is not in [-1, 1]! which I guess would assume that the matrix should be [-1, 1]? 回答1: Just indicate that it is not a correlation matrix: library(corrplot) corrplot(M, is.corr = FALSE, method = "square") 来源: https

Cross correlation of different time series data values in R

最后都变了- 提交于 2020-01-24 09:36:06
问题 I have a time series data (in day format) of 5 places for 15 days stored as a matrix . The structure of data is meter_daywise<-structure(c(24.4745528484842, 21.5936510486629, 58.9120896540103, 49.4188338105575, 568.791971631185, 27.1682608244523, 23.3482757939878, 74.710966227615, 82.6947717673258, 704.212340152625, 23.7581651139442, 21.154634543401, 64.9680107059625, 420.903181621575, 672.629513512841, 128.22871420984, 601.521395359887, 74.6606087800009, 335.87599588534, 576.451039365565,

corrplot shows insignificant correlation coefficients even when insig = “blank” is set

ⅰ亾dé卋堺 提交于 2020-01-09 10:50:58
问题 I like to use correlation plot using corrplot function with correlation coefficients printed in the cells (using addCoef.col and addCoefasPercent = TRUE ). I also like to remove the insignificant correlations from the plot (using insig = "blank" ). The problem is that this only works for the background color, but not for the coefficient itself, so the coefficient itself is still printed! See: set.seed(123) par(cex=0.8) # trick for cor. coef font size, see http://stackoverflow.com/q/26574054

R - change size of axis labels for corrplot

好久不见. 提交于 2019-12-31 21:35:13
问题 I am using the following with corrplo t: require("corrplot") ## needs the corrplot package corrplot(cor(lpp_axis1, lpp_axis2), method=c("number"), bg = "grey10", addgrid.col = "gray50", tl.offset = 2, tl.cex=2, tl.col = "black", col = colorRampPalette(c("yellow","green","navyblue"))(100)) This is created with a csv file available here. The graph is fine and I can adjust the cl labels all I want. I've tried adjusting the labels on x and y axis with no impact. I looked at changing mar - yet I

Customize correlation plot r

强颜欢笑 提交于 2019-12-25 01:34:54
问题 Hi I want to customize the plot to something like this: -I want to have some straight line inside the plot and want to change the legend to something in the left side rather than the normal legend in right side. Also add some texts beside the variables (categorize). I have tried ggcorrplot, ggcorr, corrplot, ggplot to make this, but still can't find the solution. Anyone can help? Thanks. Sample plot-How to make it? ggcorr(data = NULL, cor_matrix = corr, nbreaks = 4, hjust = 1, size = 3, color

How to return significant matches in R corrplot?

﹥>﹥吖頭↗ 提交于 2019-12-23 05:39:14
问题 I would like to return the significant matches from the following result shown in Fig. 1 library("corrplot") M <- cor(mtcars) # http://www.sthda.com/english/wiki/visualize-correlation-matrix-using-correlogram cor.mtest <- function(mat, ...) { mat <- as.matrix(mat) n <- ncol(mat) p.mat<- matrix(NA, n, n) diag(p.mat) <- 0 for (i in 1:(n - 1)) { for (j in (i + 1):n) { tmp <- cor.test(mat[, i], mat[, j], ...) p.mat[i, j] <- p.mat[j, i] <- tmp$p.value } } colnames(p.mat) <- rownames(p.mat) <-