Skip to content
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

Merged
merged 2 commits into from
Jun 3, 2022
Merged

Several fixes #45

merged 2 commits into from
Jun 3, 2022

Conversation

mikelgg93
Copy link
Collaborator

  • 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

+ 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
Copy link
Owner

@bastibe bastibe left a 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:
Copy link
Owner

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
Copy link
Owner

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.

Copy link
Collaborator Author

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
Copy link
Owner

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.

@mikelgg93
Copy link
Collaborator Author

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.
I will merge it, download the binaries and create a new release with the changelog.

@mikelgg93 mikelgg93 merged commit e949a81 into bastibe:master Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants