I've added the data in code form below. I'm aware that the correlation values might be suspiciously high, but I'd still like to visualize them in a heatmap. I want to see the correlation of all the other variables with Treatment. Additionally, I'd like to know if it's possible to visualize the values and correlation for individual treatments in one heatmap. ? Here's my data:
df <- data.frame(
Treatment = c(0, 25, 50, 100, 200),
Fresh_weight = c(40.1, 31.9, 25.9, 18.6, 34.8),
Dry_weight = c(20.0, 15.9, 11.4, 7.9, 4.9),
Chl_content = c(2.60, 2.34, 2.12, 1.78, 1.48),
Leaf_Area = c(22.00, 19.04, 15.48, 13.00, 10.87),
Li_in_Leaves = c(0.0, 6.4, 22.8, 45.7, 67.0),
Li_in_Shoot = c(0.0, 21.7, 43.7, 75.7, 99.4),
Li_in_Root = c(0.0, 28.4, 56.6, 81.2, 109.6),
Ca_in_Leaves = c(5650.0, 4233.5, 3919.3, 3708.3, 2189.4),
Ca_in_Shoot = c(6450.0, 2586.6, 27860.0, 15269.0, 1198.9),
Ca_in_Root = c(33000.0, 24107.8, 24107.8, 15269.0, 13430.0)
)
For the full data set, you can make a plot easily with the corrplot package. I'm not sure what you mean by the correlation for individual treatments. There is only one measurement for each treatment, so you can't calculate correlations.
library(corrplot)
#> corrplot 0.94 loaded
df <- data.frame(
Treatment = c(0, 25, 50, 100, 200),
Fresh_weight = c(40.1, 31.9, 25.9, 18.6, 34.8),
Dry_weight = c(20.0, 15.9, 11.4, 7.9, 4.9),
Chl_content = c(2.60, 2.34, 2.12, 1.78, 1.48),
Leaf_Area = c(22.00, 19.04, 15.48, 13.00, 10.87),
Li_in_Leaves = c(0.0, 6.4, 22.8, 45.7, 67.0),
Li_in_Shoot = c(0.0, 21.7, 43.7, 75.7, 99.4),
Li_in_Root = c(0.0, 28.4, 56.6, 81.2, 109.6),
Ca_in_Leaves = c(5650.0, 4233.5, 3919.3, 3708.3, 2189.4),
Ca_in_Shoot = c(6450.0, 2586.6, 27860.0, 15269.0, 1198.9),
Ca_in_Root = c(33000.0, 24107.8, 24107.8, 15269.0, 13430.0)
)
dfMat <- as.matrix(df)
correl <- cor(dfMat)
corrplot(correl)

Created on 2025-06-29 with reprex v2.1.1
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.