Entering edit mode
2.3 years ago
waqaskhokhar999
▴
160
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
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