Scatter distribution figure

version 1.0.0 (2.96 KB) by Eline Zwijgers
Function to create a scatter plot showing the individual data points and the distributions on the X and Y-axis.

66 Downloads

Updated 29 Apr 2022

View License

Function to create a scatter plot showing the individual data points and the distributions on the X and Y-axis.
Choose between a kernel (default) or gaussian distribution. The figure contains three subplots: Fig.scat, Fig.distx, and Fig.disty.
Options such as personalized colors, marker size, trendline, etc. are included.
% Example code with random data
datax = [randn(1,50) randn(1,50)+3 1.5*(randn(1,50)+1.5)];
datay = [0.5*datax(1:50)+2+0.4*randn(1,50) 0.7*datax(51:100)+1.8+1*randn(1,50) 0.4*datax(101:150)+2.4+0.6*randn(1,50)];
cats = [cellstr(repmat('Group A',50,1)); cellstr(repmat('Group B',50,1)); cellstr(repmat('Group C',50,1))];
figure
Fig = scatter_distribution_figure(datax, datay, cats, 'YLabel', 'Y label','XLabel','X label');
set(Fig.scat,'FontSize',23,'linewidth',2,'box','on')

Cite As

Eline Zwijgers (2022). Scatter distribution figure (https://www.mathworks.com/matlabcentral/fileexchange/110850-scatter-distribution-figure), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2019b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!