violin plot with ggtheme

Generate beautiful violin plots with professional themes.

Vous suivez désormais cette soumission

Basic usage
% X - Group positions.
% Y - Matrix data.
X = 1:5;
Y = randn(100, 5);
violinChart(gca, X, Y, 'Width',.8);
legend()
Categorical data
X = randi([1, 5], [1, 200]);
Y = randn(1, 200) + sin(X);
hdl = violinChart(gca, X, Y, 'FaceColor',[132,158,119]./255);
% Set propertied for density patches.
CList = lines(5);
for i = 1:length(hdl.F_density)
set(hdl.F_density(i), 'LineWidth',1, 'FaceColor',CList(i, :), 'FaceAlpha',.5)
end
Overlaying two violin sets on the same axes
X1 = [1:2:7, 13];
Y1 = randn(100, 5) + sin(X1);
X2 = 2:2:10;
Y2 = randn(100, 5) + cos(X2);
figure()
violinChart(gca, X1, Y1, [0, 114, 189]./255);
violinChart(gca, X2, Y2, [217, 83, 25]./255);
legend()
ggtheme
rng(1)
X1 = [1:2:7, 13];
Y1 = randn(100, 5) + sin(X1);
X2 = 2:2:10;
Y2 = randn(100, 5) + cos(X2);
figure()
hdl1 = violinChart(gca, X1, Y1, [0, 114, 189]./255);
hdl2 = violinChart(gca, X2, Y2, [217, 83, 25]./255);
legend()
theme = 'solarized';
% ylabel(strrep(theme, '_', '\_'), 'FontSize',18)
ggThemeViolin([hdl1, hdl2], theme)
% Available themes:
% 'flat', 'flat_dark', 'camouflage', 'chalk', 'copper', 'dust',
% 'earth', 'fresh', 'grape', 'grass', 'greyscale', 'light',
% 'lilac', 'pale', 'sea', 'sky', 'solarized'
Acknowledgements:
The color palettes in this toolbox are adapted from the R package 'ggthemr'
(https://github.com/Mikata-Project/ggthemr), originally created by Ciaran Tobin
and maintained by the Mikata-Project team.

Citation pour cette source

Zhaoxu Liu / slandarer (2026). violin plot with ggtheme (https://fr.mathworks.com/matlabcentral/fileexchange/120283-violin-plot-with-ggtheme), MATLAB Central File Exchange. Extrait(e) le .

Informations générales

Compatibilité avec les versions de MATLAB

  • Compatible avec toutes les versions

Plateformes compatibles

  • Windows
  • macOS
  • Linux
Version Publié le Notes de version Action
2.0.1

Change function name.

2.0.0

English support.

1.0.0