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

geom_hex no longer recognizes ..count.. #1747

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

Comments

Projects
None yet
3 participants
@Ax3man
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

This comment has been minimized.

Member

thomasp85 commented Sep 15, 2016

@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

This comment has been minimized.

Member

hadley commented Sep 15, 2016

No, just an oversight

@hadley hadley modified the milestone: v2.2.0 Sep 15, 2016

@thomasp85

This comment has been minimized.

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

This comment has been minimized.

Member

thomasp85 commented Sep 20, 2016

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

@hadley

This comment has been minimized.

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

This comment has been minimized.

Member

thomasp85 commented Sep 20, 2016

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

This comment has been minimized.

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

This comment has been minimized.

Member

thomasp85 commented Sep 20, 2016

See PR #1765

thomasp85 added a commit that referenced this issue Sep 21, 2016

Rename value to count in stat_binhex (#1765)
Fixes #1747

* Rename value to count

@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.