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

early returns means trace at a particular step may not get triggered #44

Closed
yjunechoe opened this issue Oct 23, 2021 · 1 comment
Closed
Labels
documentation Improvements or additions to documentation

Comments

@yjunechoe
Copy link
Owner

Step 2 returns empty df if data is null, so breaks early here:

> ggtrace(
  ggplot2:::Layer$map_statistic,
  seq_len(length(ggbody(ggplot2:::Layer$map_statistic))),
  quote(1 + 1)
)
> ggplot()
Triggering trace on ggplot2:::Layer$map_statistic

[Step 1]> 1 + 1
[1] 2

[Step 2]> 1 + 1
[1] 2

Call `last_ggtrace()` to get the trace dump.
Untracing ggplot2:::Layer$map_statistic on exit.

Step 8 returns data if there are no calculated or staged aesthetics, so it returns early for StatIdentity as well

> ggtrace(
  ggplot2:::Layer$map_statistic,
  seq_len(length(ggbody(ggplot2:::Layer$map_statistic))),
  quote(1 + 1)
)
> ggplot(mtcars, aes(mpg, hp)) + geom_point()
Triggering trace on ggplot2:::Layer$map_statistic

[Step 1]> 1 + 1
[1] 2

[Step 2]> 1 + 1
[1] 2

[Step 3]> 1 + 1
[1] 2

[Step 4]> 1 + 1
[1] 2

[Step 5]> 1 + 1
[1] 2

[Step 6]> 1 + 1
[1] 2

[Step 7]> 1 + 1
[1] 2

[Step 8]> 1 + 1
[1] 2

Call `last_ggtrace()` to get the trace dump.
Untracing ggplot2:::Layer$map_statistic on exit.
@yjunechoe yjunechoe added the documentation Improvements or additions to documentation label Oct 23, 2021
@yjunechoe
Copy link
Owner Author

worth noting that this was discovered by chance while working on #19 - Layer$map_statistic returns early if there are no mapped aes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant