You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This problem was identified in #6287 and affects 8 packages.
Generally, ggplot2 does not accept expressions as aesthetics.
library(ggplot2)
df<-data.frame(x=1:2, y=2:3)
ggplot(df, aes(x, y)) +
geom_text(aes(label= expression(foo, bar)))
#> Don't know how to automatically pick scale for object of type <expression>.#> Defaulting to continuous.#> Error in `geom_text()`:#> ! Problem while computing aesthetics.#> ℹ Error occurred in the 1st layer.#> Caused by error in `compute_aesthetics()`:#> ! Aesthetics are not valid data columns.#> ✖ The following aesthetics are invalid:#> ✖ `label = expression(foo, bar)`#> ℹ Did you mistype the name of a data column or forget to add `after_stat()`?
However, with the current CRAN ggplot2, you can circumvent this limitation by passing the label outside the mapping.
ggplot(df, aes(x, y)) +
geom_text(label= expression(foo, bar))
#> Warning in is.na(x): is.na() applied to non-(list or vector) of type#> 'expression'
In the dev version, we also reject expressions outside the mapping.
devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2
ggplot(df, aes(x, y)) +
geom_text(label= expression(foo, bar))
#> Error in `geom_text()`:#> ! Problem while setting up geom aesthetics.#> ℹ Error occurred in the 1st layer.#> Caused by error in `list_sizes()` at ggplot2/R/geom-.R:273:3:#> ! `x$label` must be a vector, not an expression vector.
Our increased strictness becomes a problem for reverse dependencies. I'm unsure wether ggplot2 should accommodate or the dependencies should follow ggplot2's conventions.
The text was updated successfully, but these errors were encountered:
3 did not actually have the described problem, they just threw a similar error. The problem was mostly using default_aes fields. They've been sent PRs.
3 packages did have this problem. They've been sent PRs.
2 packages are not on GitHub and their authors have been emailed.
This concludes what we can do about this problem from ggplot2's viewport, so I'm going to close this issue.
This problem was identified in #6287 and affects 8 packages.
Generally, ggplot2 does not accept expressions as aesthetics.
However, with the current CRAN ggplot2, you can circumvent this limitation by passing the label outside the mapping.
In the dev version, we also reject expressions outside the mapping.
Created on 2025-01-22 with reprex v2.1.1
Our increased strictness becomes a problem for reverse dependencies. I'm unsure wether ggplot2 should accommodate or the dependencies should follow ggplot2's conventions.
The text was updated successfully, but these errors were encountered: