Al momento, stai seguendo questo contributo
- Vedrai gli aggiornamenti nel tuo feed del contenuto seguito
- Potresti ricevere delle email a seconda delle tue preferenze per le comunicazioni
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.
Demo 1 : Basic usage
% 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)
% -------------------------------------------------------------------------
Demo 2 : Change colors and labels
% 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';
Cita come
Zhaoxu Liu / slandarer (2026). marginal plot (边际图) (https://it.mathworks.com/matlabcentral/fileexchange/123470-marginal-plot), MATLAB Central File Exchange. Recuperato .
Informazioni generali
- Versione 2.0.1 (813 KB)
Compatibilità della release di MATLAB
- Compatibile con qualsiasi release
Compatibilità della piattaforma
- Windows
- macOS
- Linux
