Skip to content

Implement filled 2d density contours (#3864) #10

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

Merged
merged 1 commit into from
Mar 13, 2020

Conversation

sthagen
Copy link
Owner

@sthagen sthagen commented Mar 13, 2020

  • initial implementation idea; still tons of stuff to do

  • geom_density2d_filled, doesn't work yet

  • fix geom_density2d_filled()

  • fix unit test

  • update usage examples

  • improve documentation

  • add news item, allow manual setting of breaks, add nlevel column to contour output

  • compute density scaled to samle size, just like in geom_density().

  • Make level numeric for filled contours. Fixes Filled contours don't play well with faceting tidyverse/ggplot2#3875.

  • Document computed variables.

  • properly contour in a two-step process

  • cleanup, better docs

  • clean-up code, docs

  • unit tests

  • add a proper stat_density_2d_filled(). Closes stat_density2d doesn't work nicely with geom_polygon tidyverse/ggplot2#3846.

  • update news

  • fix unit tests

  • keep track of the type of contour needed rather than the stat that does the work.

* initial implementation idea; still tons of stuff to do

* geom_density2d_filled, doesn't work yet

* fix geom_density2d_filled()

* fix unit test

* update usage examples

* improve documentation

* add news item, allow manual setting of breaks, add nlevel column to contour output

* compute density scaled to samle size, just like in geom_density().

* Make `level` numeric for filled contours. Fixes #3875.

* Document computed variables.

* properly contour in a two-step process

* cleanup, better docs

* clean-up code, docs

* unit tests

* add a proper `stat_density_2d_filled()`. Closes #3846.

* update news

* fix unit tests

* keep track of the type of contour needed rather than the stat that does the work.
@sthagen sthagen merged commit bcb2448 into sthagen:master Mar 13, 2020
@SimonDedman
Copy link

Hi both, sorry to bother you on this pull request thread; I'm trying to change the fill colour from the default viridis in geom_density_2d_filled, and have thrown everything bar the kitchen sink at it, with no joy. Per the note above ("fix geom_density2d_filled()"), is this due to this element not working yet?
If not, (i.e. it is working) any chance someone could pop a quick note on https://ggplot2.tidyverse.org/reference/geom_density_2d.html with an example of the correct format?
FWIW, also on that page, in the "# contour bands and contour lines" section, one doesn't need the "+ geom_density_2d()" line: including "size = 0.25, colour = "black" in the "geom_density_2d_filled" line causes contours to be generated.
Thanks in advance for any intel either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filled contours don't play well with faceting stat_density2d doesn't work nicely with geom_polygon
3 participants