marginalPlot: Visualization of grouped data with main plot and marginal plots Creates (scatter, contour, regression, etc.) main plot with upper (X-axis) and right (Y-axis) marginal distributions (histogram, boxplot, violin, rug, etc.). A total of 99 combinations are currently available.
% Generate three Gaussian-distributed datasets Data1 = mvnrnd([ 2, 3], [1, 0;0, 2], 300); Data2 = mvnrnd([ 6, 7], [1, 0;0, 2], 300); Data3 = mvnrnd([14, 9], [1, 0;0, 1], 300); DataSet = {Data1, Data2, Data3}; % Create marginal plot object and draw MP = marginalPlot(DataSet, 'MainType',6, 'UpperType',5, 'RightType',10); MP.draw();
% ========================================================================= % MainType (Main Plot) Options % ========================================================================= % No. | Type | Description % -----|--------------|---------------------------------------------------- % 1 | 'scatter' | Scatter plot with filled markers % 2 | 'contour' | Contour plot based on kernel density estimation % 3 | 'pred' | Linear regression with prediction interval (polyfit) % 4 | 'convhull' | Scatter plot with convex hull outline % 5 | 'cover' | Scatter plot with buffered/expanded convex hull (rounded) % 6 | 'ellipse' | Scatter plot with confidence ellipse (99%) % 7 | 'centroid' | Star plot: points connected to group centroid % 8 | 'errorbar' | Cross error bar (mean ± std) for each group % 9 | 'conf' | Linear regression with confidence interval (fitlm) % --------------------------------------------------------------------------- % ========================================================================= % UpperType / RightType (Marginal Plot) Options % ========================================================================= % No. | Type | Description % -----|----------------|-------------------------------------------------- % 1 | 'hist' | Standard histogram % 2 | 'kd-area' | Kernel density estimation area (filled) % 3 | 'kd-line' | Kernel density estimation line only % 4 | 'kd-both' | Kernel density area + line % 5 | 'kd-hist' | Histogram overlayed with kernel density line % 6 | 'box' | Box plot (median, quartiles, outliers) % 7 | 'violin' | Full violin plot (symmetric KDE) % 8 | 'rug' | Rug plot (vertical/horizontal line scatter) % 9 | 'joyplot' | Joyplot / Ridgeline plot (stacked KDE) % 10 | 'half-violin' | Half violin plot (right side only, compact) % 11 | 'raincloud' | Raincloud plot (half-violin + scatter) % -------------------------------------------------------------------------
% Generate three Gaussian-distributed datasets Data1 = mvnrnd([ 2, 3], [1, 0;0, 2], 300); Data2 = mvnrnd([ 6, 7], [1, 0;0, 2], 300); Data3 = mvnrnd([14, 9], [1, 0;0, 1], 300); DataSet = {Data1, Data2, Data3}; % Create marginal plot object and draw MP = marginalPlot(DataSet, 'MainType',6, 'UpperType',5, 'RightType',10); MP.ClassName = {'AAAAA','BBBBB','CCCCC'}; MP.CData = [122,117,119; 255,163, 25; 135,146, 73; 126, 15, 4; 30, 93,134]./255; MP.draw(); MP.axM.XLabel.String = 'Thank U very much for your five-star review !!!'; MP.axM.YLabel.String = 'Rate me please.'; MP.axU.YLabel.String = 'Marginal plot'; MP.axR.XLabel.String = 'Made by slandarer';