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

No way to specify number of bins in stat_density_2d #1448

Closed
ecoRoland opened this issue Dec 23, 2015 · 5 comments
Closed

No way to specify number of bins in stat_density_2d #1448

ecoRoland opened this issue Dec 23, 2015 · 5 comments

Comments

@ecoRoland
Copy link

@ecoRoland ecoRoland commented Dec 23, 2015

stat_density2d used to pass the ellipses to stat_contour. That way one could specify the number of bins.

Pre-v2.0.0:

m <- ggplot(faithful, aes(x = eruptions, y = waiting)) +
  geom_point() +
  xlim(0.5, 6) +
  ylim(40, 110)
m + geom_density2d(bins = 3)

Since stat_density_2d doesn't do that anymore, I don't see a way to specify the number of bins. If I'm not missing something that seems like a regression.

@has2k1
Copy link
Contributor

@has2k1 has2k1 commented Dec 24, 2015

That is maybe an inconsistency (given that bins is used for partitioning the grid in other cases) in the API. Use n = 3.

@ecoRoland
Copy link
Author

@ecoRoland ecoRoland commented Dec 30, 2015

@has2k1 I don't follow. n = 3 is passed to kde2d and does not specify the number of bins.

@has2k1
Copy link
Contributor

@has2k1 has2k1 commented Dec 31, 2015

@ecoRoland, maybe I do not understand what you mean by bins, but n does partition the grid and that is equivalent to bins. In 2nd example from the bottom at http://docs.ggplot2.org/dev/geom_density_2d.html, that is n=100 which is 100 bins.

@MikeWise2718
Copy link

@MikeWise2718 MikeWise2718 commented Dec 31, 2015

Can you replicate this http://stackoverflow.com/questions/19329318/how-to-correctly-interpret-ggplots-stat-density2d effect with the n=4 parameter? I couldn't...

@has2k1
Copy link
Contributor

@has2k1 has2k1 commented Dec 31, 2015

Oh. Okay, you cannot do that anymore. The 2.0 clean up means parameters do not fall through any more. I'll submit a PR.

has2k1 added a commit to has2k1/ggplot2 that referenced this issue Dec 31, 2015
This was a regression due to the `...` refactoring.

Fixes tidyverse#1448
@hadley hadley closed this in 91c8bf1 Dec 31, 2015
wch added a commit that referenced this issue Jan 4, 2016
This was a regression due to the `...` refactoring.

Fixes #1448
@lock lock bot locked as resolved and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants