bastibe / Violinplot-Matlab

Violin Plots for Matlab
https://mathworks.com/matlabcentral/fileexchange/170126-violinplot-matlab
BSD 3-Clause "New" or "Revised" License
251 stars 105 forks source link

how to select colors for each violin? #27

Closed antoinemadar closed 3 years ago

antoinemadar commented 3 years ago

Hello, Thank you for your code. I was trying to define a colormap for each violin (i.e. each group) but couldn't figure out how. I tried using a matrix of RGB values for each group, like for boxplot, without success: violinplot([DataCTR; DataKA], [groupsCTR-0.5; groupsKA+0.5], 'ViolinColor', [0, 0, 0; 1,0,0; 0,0,0; 1,0,0; 0,0,0; 1,0,0]); I also tried calling the function twice, using different colors for my treatment and control datasets, but it puts the violins on top of each other, probably because it considers the groups as categories and not a continuous variable: violinplot(DataCTR, groupsCTR-0.5, 'ViolinColor', [0, 0, 0]); hold on violinplot(DataKA, groupsKA+0.5, 'ViolinColor', [1, 0, 0]); Any suggestion? Thank you for your time and help

antoinemadar commented 3 years ago

My apologies, I just realized that you already answered this basic question before. I m not very familiar with github and just noticed the "closed issues" tab. Here's the link to your previous answer that answers my issue: https://github.com/bastibe/Violinplot-Matlab/issues/15#issuecomment-540451437 Thanks