Skip to content
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

respect thresholds passed to contourDensity #57

Merged
merged 1 commit into from
Jun 23, 2022
Merged

Conversation

Fil
Copy link
Member

@Fil Fil commented Jun 23, 2022

When passing thresholds([0.5]) to contourDensity, one would expect the returned thresholds to be [0.5], but instead we get 0.5 * 2^-2k = 1/32 (with the default cellSize k=2).

This fixes the logic so that the thresholds are respected. Unfortunately it is a breaking change or any user who has manually set those thresholds.

@Fil Fil added the bugfix label Jun 23, 2022
Fil added a commit to observablehq/plot that referenced this pull request Jun 23, 2022
note: we have to go around this bug in d3-contour: d3/d3-contour#57
@Fil Fil merged commit 6da53fc into main Jun 23, 2022
@Fil Fil deleted the fil/fix-density-thresholds branch June 23, 2022 14:29
Fil added a commit to observablehq/plot that referenced this pull request Jun 24, 2022
note: we have to go around this bug in d3-contour: d3/d3-contour#57
mbostock pushed a commit to observablehq/plot that referenced this pull request Jun 24, 2022
note: we have to go around this bug in d3-contour: d3/d3-contour#57
mbostock pushed a commit to observablehq/plot that referenced this pull request Jun 24, 2022
note: we have to go around this bug in d3-contour: d3/d3-contour#57
mbostock added a commit to observablehq/plot that referenced this pull request Jun 24, 2022
* density contours as an initializer: first pass

* density by z, carrying styles and channels (no reducer, only "first")

* fill: "density"

* density weight

* consistent thresholds across facets and series

note: we have to go around this bug in d3-contour: d3/d3-contour#57

* allow initializer composition; move initializer to the class; clean up

* density weight example

* error if x or y is undefined

(in the future we might route those to 1-dimensional transforms—KDE)

* document

* reduce img

* * don't apply the scales if we are already in pixel space (e.g. when composing with the hexbin transform)
* avoids a crash when there is no contour

* 1d density contours with frameAnchor

* adopt d3@7.4.5 for https://github.com/d3/d3-contour/releases/tag/v3.0.2

(not entirely sure if it's good practice to have all the yarn.lock changes in the PR, beyond those that are relevant)

* replace example image

* mike’s edits

* fix image dimensions

* isDensity

* distinct

* tweak tests

Co-authored-by: Mike Bostock <mbostock@gmail.com>
mbostock added a commit to observablehq/plot that referenced this pull request Jun 24, 2022
* density mark

* density contours stroke & fill (#948)

* density contours as an initializer: first pass

* density by z, carrying styles and channels (no reducer, only "first")

* fill: "density"

* density weight

* consistent thresholds across facets and series

note: we have to go around this bug in d3-contour: d3/d3-contour#57

* allow initializer composition; move initializer to the class; clean up

* density weight example

* error if x or y is undefined

(in the future we might route those to 1-dimensional transforms—KDE)

* document

* reduce img

* * don't apply the scales if we are already in pixel space (e.g. when composing with the hexbin transform)
* avoids a crash when there is no contour

* 1d density contours with frameAnchor

* adopt d3@7.4.5 for https://github.com/d3/d3-contour/releases/tag/v3.0.2

(not entirely sure if it's good practice to have all the yarn.lock changes in the PR, beyond those that are relevant)

* replace example image

* mike’s edits

* fix image dimensions

* isDensity

* distinct

* tweak tests

Co-authored-by: Mike Bostock <mbostock@gmail.com>

Co-authored-by: Philippe Rivière <fil@rezo.net>
frontend-provider added a commit to frontend-provider/plot that referenced this pull request Sep 20, 2023
* density mark

* density contours stroke & fill (#948)

* density contours as an initializer: first pass

* density by z, carrying styles and channels (no reducer, only "first")

* fill: "density"

* density weight

* consistent thresholds across facets and series

note: we have to go around this bug in d3-contour: d3/d3-contour#57

* allow initializer composition; move initializer to the class; clean up

* density weight example

* error if x or y is undefined

(in the future we might route those to 1-dimensional transforms—KDE)

* document

* reduce img

* * don't apply the scales if we are already in pixel space (e.g. when composing with the hexbin transform)
* avoids a crash when there is no contour

* 1d density contours with frameAnchor

* adopt d3@7.4.5 for https://github.com/d3/d3-contour/releases/tag/v3.0.2

(not entirely sure if it's good practice to have all the yarn.lock changes in the PR, beyond those that are relevant)

* replace example image

* mike’s edits

* fix image dimensions

* isDensity

* distinct

* tweak tests

Co-authored-by: Mike Bostock <mbostock@gmail.com>

Co-authored-by: Philippe Rivière <fil@rezo.net>
backend-devloper pushed a commit to backend-devloper/plot that referenced this pull request Nov 24, 2023
* density mark

* density contours stroke & fill (#948)

* density contours as an initializer: first pass

* density by z, carrying styles and channels (no reducer, only "first")

* fill: "density"

* density weight

* consistent thresholds across facets and series

note: we have to go around this bug in d3-contour: d3/d3-contour#57

* allow initializer composition; move initializer to the class; clean up

* density weight example

* error if x or y is undefined

(in the future we might route those to 1-dimensional transforms—KDE)

* document

* reduce img

* * don't apply the scales if we are already in pixel space (e.g. when composing with the hexbin transform)
* avoids a crash when there is no contour

* 1d density contours with frameAnchor

* adopt d3@7.4.5 for https://github.com/d3/d3-contour/releases/tag/v3.0.2

(not entirely sure if it's good practice to have all the yarn.lock changes in the PR, beyond those that are relevant)

* replace example image

* mike’s edits

* fix image dimensions

* isDensity

* distinct

* tweak tests

Co-authored-by: Mike Bostock <mbostock@gmail.com>

Co-authored-by: Philippe Rivière <fil@rezo.net>
tigrevol8888 added a commit to tigrevol8888/plot that referenced this pull request Jul 5, 2024
* density mark

* density contours stroke & fill (#948)

* density contours as an initializer: first pass

* density by z, carrying styles and channels (no reducer, only "first")

* fill: "density"

* density weight

* consistent thresholds across facets and series

note: we have to go around this bug in d3-contour: d3/d3-contour#57

* allow initializer composition; move initializer to the class; clean up

* density weight example

* error if x or y is undefined

(in the future we might route those to 1-dimensional transforms—KDE)

* document

* reduce img

* * don't apply the scales if we are already in pixel space (e.g. when composing with the hexbin transform)
* avoids a crash when there is no contour

* 1d density contours with frameAnchor

* adopt d3@7.4.5 for https://github.com/d3/d3-contour/releases/tag/v3.0.2

(not entirely sure if it's good practice to have all the yarn.lock changes in the PR, beyond those that are relevant)

* replace example image

* mike’s edits

* fix image dimensions

* isDensity

* distinct

* tweak tests

Co-authored-by: Mike Bostock <mbostock@gmail.com>

Co-authored-by: Philippe Rivière <fil@rezo.net>
LordOfCodes26 added a commit to LordOfCodes26/plot that referenced this pull request Aug 15, 2024
* density mark

* density contours stroke & fill (#948)

* density contours as an initializer: first pass

* density by z, carrying styles and channels (no reducer, only "first")

* fill: "density"

* density weight

* consistent thresholds across facets and series

note: we have to go around this bug in d3-contour: d3/d3-contour#57

* allow initializer composition; move initializer to the class; clean up

* density weight example

* error if x or y is undefined

(in the future we might route those to 1-dimensional transforms—KDE)

* document

* reduce img

* * don't apply the scales if we are already in pixel space (e.g. when composing with the hexbin transform)
* avoids a crash when there is no contour

* 1d density contours with frameAnchor

* adopt d3@7.4.5 for https://github.com/d3/d3-contour/releases/tag/v3.0.2

(not entirely sure if it's good practice to have all the yarn.lock changes in the PR, beyond those that are relevant)

* replace example image

* mike’s edits

* fix image dimensions

* isDensity

* distinct

* tweak tests

Co-authored-by: Mike Bostock <mbostock@gmail.com>

Co-authored-by: Philippe Rivière <fil@rezo.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants