-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
violin
: honor bandwidth
attribute even if values in a trace are identical
#3626
Conversation
At the moment, the default bandwidth for a violin with zero standard deviation (ie. all values are identical) is 1. Therefore, you will get a significant violin area as shown in this comment which is not what other libraries do (like Seaborn for example). For people who don't know the details of violin plot (like me yesterday), this may look weird/wrong. @alexcjohnson do you think we should greatly reduce the bandwidth when all values are identical so the violin collapses? |
Right, I think the default behavior with all identical values should be zero width, as you had in #3625. But if someone provides an explicit |
With commit 5acb518 we have a mock showcasing both situations (identical values with and without explicit bandwidth). I had to explicitly set the bandwidth to 1 on an existing mock to preserve baselines intact. |
@@ -86,6 +86,9 @@ | |||
} | |||
], | |||
"layout": { | |||
"template": { | |||
"data": {"violin": [{"bandwidth": 1}]} |
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.
Nice use of template
🏆
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.
Hmm. I think I would prefer updating the baselines instead of tweaking the JSON mocks.
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.
Done in 4698df0
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.
Not a big deal, but to me the original baselines are a lot easier to look at and understand what's going on. But of course either way it'll serve the function of catching unintended changes.
💃 |
@antoinerg looks like this PR resolves #2779 as well, correct? |
Yes it does! I updated my first comment to reflect that. Nice catch 👀 |
good to merge 💃 |
Hi, a quick update, passed by here because I got the same problem. |
Following botched PR #3625, this PR closes #3622 by honoring
trace.bandwidth
even if all the values are identical.When no bandwidth is specified and all values are identical, it draws the violin as a line. Therefore, this PR also closes #2779!