Skip to content

Update aesthetics of length 1 warning #5799

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

Merged
merged 4 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion R/layer.R
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ Layer <- ggproto("Layer", NULL,
&& length(aes_n) > 0 && all(aes_n == 1) && n > 1) {
cli::cli_warn(c(
"All aesthetics have length 1, but the data has {n} rows.",
i = "Did you mean to use {.fn annotate}?"
i = "Please consider using {.fn annotate} or provide this layer \\
with data containing a single row."
), call = self$constructor)
}
check_aesthetics(evaled, n)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
# layer warns for constant aesthetics

All aesthetics have length 1, but the data has 32 rows.
i Did you mean to use `annotate()`?
i Please consider using `annotate()` or provide this layer with data containing a single row.

# layer_data returns a data.frame

Expand Down