-
Notifications
You must be signed in to change notification settings - Fork 184
Default bins too narrow using Plot.binX #417
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
Comments
Doesn't this mean we have two issues? a) in some cases the default binning strategy creates too many bins this might be addressed at the level of d3.thresholdScott, not based on the chart's width; or on the level of Plot.bin, based on the chart's width? b) insets can "reverse" a rect and make it invisible the formula is (in rect.js): here maybe the minimum width should be more than 0, perhaps 0.5? It would not eliminate all cases, in particular if you have a white stroke and the default fill-then-stroke paint order, but it would mean that a mark however small is never "zero-width". This is a more general problem, for example when stacking values, the values that generate a rect that smaller than 1px can disappear from view if they have a white stroke. Should we decide we want all marks' geometries to be visible as described above, the rendering might still sometimes make them invisible, sometimes deliberately (fillOpacity: 0), sometimes unwittingly (stroke: white). I'm not sure it's possible to fix that, tbh, since we can't make a pixel be at the same time white and black. It's not only rects, in practice we often have to add a half-pixel to a point's radius so that the colored surface area (after the inner part of the 1px white stroke has been deducted) is proportional to the value. The default |
@severo has found a different avatar of this issue, when you bin on a single value:
|
Another difference is that Plot's (and D3's) bins conflate nulls and zeros, resulting in about 35k members in the first bin, whereas ggplot2 counts about 20k members (there are 15061 nulls in the data). |
Filed d3/d3-array#203 for the null conflation issue. |
…px), unless the original width or height is 0. See discussion in #417
That was a productive issue with I don't know how to address @severo's example though: |
We might look at how other libraries handle this case |
* cap the default number of bins at 200 (see #417) * no closure; explicit args * default argument * explicit "auto" thresholds * rename to thresholdAuto * update README Co-authored-by: Mike Bostock <[email protected]>
Calling this fixed by #421 (and #470), though see #422 (comment). |
The default binning in Plot can create rects with a width that is too small to see (making a user -- namely, me -- believe the code is broken). As an example (also see this notebook):
Compared to the same plot made using ggplot2:
The text was updated successfully, but these errors were encountered: