how to do violin plot in matlab

236 vues (au cours des 30 derniers jours)
Sansit Das
Sansit Das le 27 Jan 2020
I want to plot the Violin Graph with my data, but I am not able to get how to plot those graphs. I saw the Distribution Plot,Distribution Plot in File exchange for Matlab, but I am unable to find the place to input my x-values and y-values.

Réponse acceptée

Matt J
Matt J le 29 Jan 2020
Modifié(e) : Matt J le 29 Jan 2020
  13 commentaires
AARISH NAWAZ
AARISH NAWAZ le 24 Mai 2022
Modifié(e) : AARISH NAWAZ le 25 Mai 2022
I have plotted a red line first (see attchment) and using hold on I plotted the violin plots on the same figure but it starts with 1 I want it to start from zero (I want to move each violin plot to one place left).
@Matt J I have attached the matlab file and the .mat data file. Please have a look
Thanking you in anticipation
AARISH NAWAZ
AARISH NAWAZ le 26 Mai 2022
How to change Violin Plot axis? I am able to plot it but It starts with one by default, I want it to start from zero. Please see the previous comment from me. You can find all the codes and data required to understand the question. @Matt J

Connectez-vous pour commenter.

Plus de réponses (2)

Holger Hoffmann
Holger Hoffmann le 9 Déc 2021
Modifié(e) : Holger Hoffmann le 9 Déc 2021
Hi - you may also consider to use this one and modify it: Violin Plot - File Exchange - MATLAB Central (mathworks.com)

Adam Danz
Adam Danz le 9 Oct 2024
MATLAB now has a violinplot, introduced in R2024b.
See also swarmchart
tiledlayout(3,1)
violinplot(nexttile,rand(20,3).*[.8 1. 1.2]+[-1 0 1],'Orientation','horizontal')
violinplot(nexttile,0,'DensityDirection','positive')
hold on
violinplot(2,'DensityDirection','negative')
violinplot(nexttile,magic(4));

Catégories

En savoir plus sur Discrete Data Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by