-
Notifications
You must be signed in to change notification settings - Fork 185
fix misaligned range #1633
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
fix misaligned range #1633
Conversation
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'm not sure I understand the rationale. I see three possibilities:
- We consider it as a user mistake; in that case, we should add a warning, instead of/in addition to truncating.
- It is expected that users might pass mismatching domain+range in some legitimate cases (which ones?). Then again, why truncate it: it's only the legend that would need to be fixed.
- It's a missed opportunity to define a color ramp for a quantitative color scale with a simple [min, max] domain.
The rationale is that the legend is inconsistent with the chart! They should be consistent or else the legend is misleading. It’s already the documented behavior with D3 that the shorter of the domain and range is used, so I’m just adopting the same behavior in Plot for the legend—we already behaved this way in the plot and scale itself. I can add a warning, but I don’t think it really merits it because the legend does a better job of explaining what is happening. There are surely other places where we ignore extra arguments and we don’t warn for those. |
To elaborate:
|
Thanks for the detailed answer! I was just reading the documentation for scales to clarify my comment—and I realize I can't find any mention of polylinear or piecewise scales. |
* fix misaligned range * warn on extra elements
Fixes #1632.