This function creates multiple bivariate scatterplots similar to SPSS's Matrix Scatterplot but without duplicate relationships. A linear fitted line, the correlation coefficient and the associated p-value are included in each plot. It is helpful when you want to explore the relationships among several variables.
John Chow (2021). Correlation Matrix Scatterplot (https://www.mathworks.com/matlabcentral/fileexchange/53043-correlation-matrix-scatterplot), MATLAB Central File Exchange. Retrieved .
Inspired by: tight_subplot(Nh, Nw, gap, marg_h, marg_w)
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
Simple and useful! thanks
I have revised the program in respond to the comments by Christian Karcher and Robyn Feiss.
This worked great, but would not plot the fitted lines. I believe it is because I have NaN values in my dataset. Is there anyway to ignore the NaNs when plotting the fitted lines?
Very useful. Thanks for sharing!
Indeed a simple and useful function. Thanks!
Some minor adjustments were required to get it working without the statistics toolbox (corrcoef instead of corr, max()-min() instead of range()), but afterwards it produced the desired output. Thanks!
@Thomas Have you tried the sample at the top of the codes. I just downloaded the program and processed the sample data and ended up with a figure the same as the cover figure. Note: There should be a '%' before 'orient tall' on line 17.) Feel free to send me your data in XLS for me to try if you are still having problems.
p-value calculation appears incorrect, getting p=0.000 for data with little to no correlation.
p-values for negatively correlated variables (negative coefficient) is always 0.
p-value calculation appears incorrect, getting p=0.000 for data with little to no correlation.