Skip to content
Prev 6085 / 7420 Next

correlation plot in color

Dear all,



First of all, I hope this email will find you well.



I am working with a biological dataset (please see in attachment) composed by 5 variables. The columns EMF, Biodiversity, MDS1 and MDS2 are numerical variables whereas T is a categorical one.



I would like to obtain a correlation chart showing correlation coefficients, histograms and different colours for each observation following the categorical variable "T". Please see below the initial chart I got but in which observations are not classified in different colours following the categorical variable "T".



This is the code I used with any positive result back.



corrMatOrder (dataset, histogram = T, pch = 19, method= spearman, family="CM Roman", col=c("red", "green3", "blue", "black")[code.levels(dataset$T)])



I work with Rstudio. Thank you very much for your time and help.

Best



Manuel