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

Strip .data from default labels #3746

Merged
merged 4 commits into from
Jan 20, 2020
Merged

Strip .data from default labels #3746

merged 4 commits into from
Jan 20, 2020

Conversation

hadley
Copy link
Member

@hadley hadley commented Jan 20, 2020

@thomasp85 this ensures that when you use the .data pronoun with ggplot2, it doesn't adversely affect the labels.

@paleolimbot β€” this should make your talk slightly simpler πŸ˜„

@hadley hadley requested a review from thomasp85 January 20, 2020 14:10
Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't strip_dots() get the plotenv passed into it with this new setup?

@hadley
Copy link
Member Author

hadley commented Jan 20, 2020

I don't think the plotenv should matter here, since all the environment information is stored in the quosures inside the aesthetics. The function signature is mildly confusing because the default env should never actually be used since it's always overridden by the quosure environment; it's only need to get recursion off the ground.

@thomasp85 thomasp85 self-requested a review January 20, 2020 14:24
Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you feel certain about this then fine... but leave a comment about it because we usually use plotenv instead of globalenv

@hadley
Copy link
Member Author

hadley commented Jan 20, 2020

If you're concerned about it, I can just leave it without a default β€” if it fails (which based on my understanding of the code, shouldn't happen), it'll be caught by the tryCatch() so you'll just get a slightly less optimal label.

@thomasp85
Copy link
Member

I have no problem with it, but it is just slightly unclear that evaluation happens in the correct environment without a comment. So for future generations of me, I'd like a small comment

@thomasp85
Copy link
Member

If you remove the default, the argument is basically unused all the way through the recursion. Why have the argument at all then? I feel I'm missing something about this code...

@thomasp85
Copy link
Member

Ah... now I see. Disregard my last comment

NEWS.md Outdated Show resolved Hide resolved
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.

None yet

3 participants