-
Notifications
You must be signed in to change notification settings - Fork 62
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
Breaking change with contour-density thresholds starting from v3.0.2 #70
Comments
This notebook: https://observablehq.com/@fil/density-thresholds-70 Suppose you wanted to pass the following thresholds in d3-contour 3.0.1:
this would return contours with values:
This was inconsistent (you ask for 1, you get 1/16). #57 fixes the inconsistency, so starting with 3.0.2, you would pass this instead:
and get the same contours (with the same values). The relationship between the two is this ratio 2**k with k the cellSize which defaults to 4; in other words you should find the same contours as before if you did:
|
Hi, @Fil ! Line 130 in 5e9ee8a
So, to get a correct results, seems like we need to use the following formula when using cellSize method:
|
Hi guys,
We are updating our dependency on d3-contour from 3.0.1 to 4.0.2.
But, it looks like it's not backward compatible starting from 3.0.2.
The breaking change was introduced in PR#57 and published as a patch version (3.0.2)
In our application, we provide thresholds as a callback function which returns an array:
contourDensity().thresholds((densityValues) => someArrayOfThresholds)
Could you suggest, how to make it compatible with the latest version (4.0.2) of d3-contour?
Maybe we need to use some built-in function like
thresholdFreedmanDiaconis
,thresholdScott
,thresholdSturges
to make the density chart drawn correctly again?The text was updated successfully, but these errors were encountered: