How to include median and quartiles in a violin plot with the functin violinplot in MATLAB 2024b?
Mostrar comentarios más antiguos
Hi,
How to include median and quartiles in a violin plot with the functin violinplot in MATLAB 2024b? The function violinplot only gives the violin shape but does not include any information like medain or quartiles.
Also, I have data limitted to values between 0 and 1 but the violin plot shows values above 1 and below zero. Is it normal? Thanks.
Respuesta aceptada
Más respuestas (1)
That functionality is not currently available in violinplot. However, you might consider using this File Exchange implementation of violin plots: https://www.mathworks.com/matlabcentral/fileexchange/45134-violin-plot
Otherwise, you can add them manually.
ydata = randn(100,3);
violinplot(ydata)
hold on
p(1)=plot(mean(ydata),'ro');
p(2)=plot(median(ydata),'kx');
hold off
ylabel("Age (years)")
legend(p,["Mean","Median"])
1 comentario
Sudhee
el 6 de Feb. de 2025
Categorías
Más información sobre Data Distribution Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


