-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
add fallback in autobin routine #1284
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
Conversation
- so that trying to plot a histogram with categorical sample pts on a linear axis result in blank plot instead of `ax.dtick` exception.
This bug was discovered while debugging for #1231 but does not resolve #1231 @alexcjohnson looks ok? |
// fallback if ax.d2c output BADNUMs | ||
// e.g. when user try to plot categorical bins | ||
// on a layout.xaxis.type: 'linear' | ||
if(!isNumeric(size0)) size0 = 0; |
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.
If a bin size of 0
made it through, this could lead to infinite loops or divide-by-zero errors somewhere else. It looks like Axes.autoTicks
has its own fallback for this so dummyAx.dtick
won't be zero, which is why this works for now, but perhaps it would be better to use size0 = 1
instead so we don't have to depend on this behavior from autoTicks
?
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 755c143
- for better protection from infinity loops in Axes.autoTicks
}); | ||
}); | ||
|
||
it('should not error out for categories on linear axis', function() { |
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.
This case and the two below resulted in errors previously.
💃 |
so that trying to plot a histogram with categorical sample pts on a linear axis result in blank plot instead of
ax.dtick
exception.For example,
currently lead to:
with this patch, the above snippet generates a blank graph.