Violin plot has tails that go beyond real data

8 views (last 30 days)
Hi everyone,
I'm using the awesome "distributionPlot.m" from file exchange in order to plot some nice violins.
I've noticed that the violins have tails that don't reflect my data - it is under the lowest value and above the highest.
for example: here's violin of data that is ALL POSITIVE! how come it goes below zero?
appreciate any help,
shir
violin.png
  2 Comments
shir shalom
shir shalom on 10 Dec 2018
thank you so much!
i used it and indeed it doesn't create the tails, but it also not a nice violin (attached).
can i smooth it somehow?uglyViolin.png

Sign in to comment.

Answers (1)

Ruggero G. Bettinardi
Ruggero G. Bettinardi on 11 Dec 2018
Hi Shir,
I uploaded an updated version of 'distributionPlot' on my FileXchange page, 'distributionPlot_OnlyPositive'. This version of the function works exactly as the original one, but avoid violins whose lower tail go below zero.
NOTE that, however, as this function is still based on normal kernel smoothing, it does not guarantee to plot violins whose lower/upper tail extend only in the exact range of your input values. It does only guarantee not to plot violins with tails extending below zero.
HTH
Ruggero
  1 Comment
shir shalom
shir shalom on 11 Dec 2018
OMG Ruggero that is amazing!
Thank you so much for taking the time to solve this issue on (the great) distributionPlot.m.
I will try it ASAP and let you know how it went.
Thanks for your help,
Shir

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!