-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Several fixes #45
Several fixes #45
Conversation
+ Now the parameter 'MarkerSize' does also affect the scatter plot, and not only the Median. + Added a check to detect the version number of Matlab and decide to use colororder or the colormap lines as default. + Added a quick fix for datasets where not many data is available, and is quite simmilar, causing interp1 to fail. + Changed default alpha value for the shadow quartiles and the scatter, so they are more visible. modified: test_cases/testviolinplot.m
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your changes! Thank you for working on the Violinplot!
Feel free to commit without my approval. But if you're interested, I left some comments where I feel things could be improved or clarified slightly.
Violin.m
Outdated
try | ||
meanDensityWidth = interp1(value, density, meanValue)*width; | ||
catch | ||
% TODO: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this marked TODO?
Violin.m
Outdated
obj.ViolinPlot.FaceAlpha = alpha{1}; | ||
obj.ScatterPlot.MarkerFaceAlpha = alpha{1}; | ||
obj.ScatterPlot.MarkerFaceAlpha = 1;% reverse to alpha{1}? This increases visibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think comments such as these should be deleted from the repo before merging.
And personally, I'd be very weary about changing default values, even for good reasons. Existing users might rely on existing functionality. At the very least we should provide a clear changelog whenever a new version is released, so users can find the cause of any regression quickly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hesitant to modify this too, but markers of the scatter plot had the same alpha value as the violin, therefore they were not easily visible depending on what colours were chosen.
Violin.m
Outdated
@@ -195,7 +201,15 @@ | |||
|
|||
%% Plot the data points within the violin area | |||
if length(density) > 1 | |||
jitterstrength = interp1(value, density*width, data); | |||
try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a feeling that there might exist a better solution than try/catch, by checking the preconditions for interp1 manually, or indeed sorting the values manually.
But maybe that solution would add too much complexity, which might not be warranted for this simple application.
Sy, it took me so long to reply, I have been a bit busy. So I've removed the try/catch in favour of using unique, that´s why I marked it as TODO before, I thought it left the pull request as a draft but I obviously did not. |
Now the parameter 'MarkerSize' does also affect the scatter plot, and not only the Median.
Added a check to detect the version number of Matlab and decide to use colororder or the colormap lines as default.
Added a quick fix for datasets where not many data is available, and is quite simmilar, causing interp1 to fail.
Changed default alpha value for the shadow quartiles and the scatter, so they are more visible.
modified: test_cases/testviolinplot.m