Change colors of each histogram in correlation and phenotypic distribution plot
0
0
Entering edit mode
2.3 years ago

I have generated a correlation and phenotypic distribution plot using "psych" library in R.

Code I have used:

library(psych)
pairs.panels(data_seedsize,
         smooth = T,      # If TRUE, draws loess smooths
         scale = F,      # If TRUE, scales the correlation text font
         density = TRUE,     # If TRUE, adds density plots and histograms
         ellipses = T,    # If TRUE, draws ellipses
         method = "pearson", # Correlation method (also "spearman" or "kendall")
         pch = 21,           # pch symbol
         bg =c("#3C875F", "#3C875F", "#3C875F","#3C875F", "#3C875F"),
         lm = F,         # If TRUE, plots linear fit rather than the LOESS (smoothed) fit
         cor = TRUE,         # If TRUE, reports correlations
         jiggle = F,     # If TRUE, data points are jittered
         factor = 2,         # Jittering factor
         hist.col = c("#3C875F", "#3C875F", "#3C875F","#3C875F", "#3C875F"),       # Histograms color
         hist.legend = "topleft",
         stars = TRUE,       # If TRUE, adds significance level with stars
         ci = T)          # If TRUE, adds confidence intervals

And it generated following image

I am interested to represent each trait with different color in the histogram, i.e separate color to W_CVARS, W_GH, W_Field, Length, width and density. I have tried to modify hist.col = c("#ff0000", "#627031", "#efb02d","#b59642", "#3C875F","#889b3b") but instead of changing the complete histogram it only change one bar

Color

Histogram • 589 views
ADD COMMENT

Login before adding your answer.

Traffic: 2524 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6