Skip to content

geom_hex no longer recognizes ..count.. #1747

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

Closed
Ax3man opened this issue Sep 12, 2016 · 8 comments
Closed

geom_hex no longer recognizes ..count.. #1747

Ax3man opened this issue Sep 12, 2016 · 8 comments
Assignees
Milestone

Comments

@Ax3man
Copy link
Contributor

Ax3man commented Sep 12, 2016

Strongly related to #1608.

This used to work:

DF <- data.frame(x=rnorm(1000), y=rnorm(1000))
ggplot(DF) + geom_hex(aes(x=x, y=y, alpha=..count..))

But now returns the error: object 'count' not found. #1608 reported the same behavior for ..density.. but this has been resolved since. There is a perfectly viable workaround using ..value.. instead, but ..count.. seems more consistent with other stats and geoms, and old code may no longer work.

Also see on SO.

@thomasp85
Copy link
Member

@hadley - is there a reason for renaming count to value? Looking into StatBin and StatBin2D they still use count so I think we need to be consistent...

@hadley
Copy link
Member

hadley commented Sep 15, 2016

No, just an oversight

@hadley hadley modified the milestone: v2.2.0 Sep 15, 2016
@thomasp85
Copy link
Member

thomasp85 commented Sep 20, 2016

@hadley Should this be fixed in hexBinSummarise() - it also touches StatSummaryHex and I'm unsure whether value rather than count is expected there..?

@thomasp85
Copy link
Member

The default aes in StatSummaryHex uses value, but this might just be to fit the output rather than the correct behaviour...

@hadley
Copy link
Member

hadley commented Sep 20, 2016

Ah this is going to be awkward to fix because it's natural for stat_hex to use count, but for stat_summary_hex to use value, and they're both implemented with the same underlying stat.

Might just be better to leave the behaviour as is, and better document.

@thomasp85
Copy link
Member

It's not too big of an issue as it can be intercepted in StatBinHex after the call to hexBinSummarise() - just needed to know where the fix should be implemented

@hadley
Copy link
Member

hadley commented Sep 20, 2016

But how would you know when to make the transformation? It seems like a decent amount of work for little gain.

@thomasp85
Copy link
Member

See PR #1765

thomasp85 added a commit that referenced this issue Sep 21, 2016
@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
Development

No branches or pull requests

3 participants