Skip to content

Strip .data from default labels - #3746

Merged
hadley merged 4 commits into
v3.3.0-rcfrom
data-labels
Jan 20, 2020
Merged

hadley merged 4 commits into
v3.3.0-rcfrom
data-labels

Conversation

@hadley

@hadley hadley commented Jan 20, 2020

Copy link
Copy Markdown
Member

@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

@thomasp85 thomasp85 left a comment

Copy link
Copy Markdown
Member

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

hadley commented Jan 20, 2020

Copy link
Copy Markdown
Member Author

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

@thomasp85 thomasp85 left a comment

Copy link
Copy Markdown
Member

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

hadley commented Jan 20, 2020

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

Comment thread NEWS.md Outdated
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.

3 participants