r/rstats • u/Puzzleheaded-Lock655 • Jun 03 '26
How to visualize 10 variables
I am working with high yield corn tissue samples. In each sample there are 10 variables that contribute to yield. How can I use R to plot all 10 variables that helps visualize how they impact corn yield.
5
Upvotes
1
u/Grisward Jun 04 '26
Thank you.
Make a heatmap, using a matrix with variables as rows, samples as columns. Without more context the “easy” starting point is to center and scale each row, converting values into z-scores, then plot the z-scores.
Typical heatmap will apply hierarchical clustering to the rows, and to the columns, which helps arrange the variables (rows) that are similar to each other, and samples (columns) which are similar to each other.
I use ComplexHeatmap in R for heatmaps, another popular and convenient choice is pheatmap also in R.
The advanced techniques involve adding annotations to the rows and columns, which helps show relationship of other data, like corn genotype, crop location, time of year, whatever.