-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
Description
This came up here, and I think I can reduce it to the presence of a time zone attribute in a POSIXct vector. Not sure if this is a vctrs issue or ggplot2, but this is where it showed up.
Minimal reprex:
library(ggplot2)
x = data.frame(x = 1:6, y = 6:1, time = strptime("2020-09-14",format="%Y-%m-%d") + 1:6)
ggplot(x) + geom_point(aes(x=x, y=y)) +facet_wrap(~time) # OK
x = data.frame(x = 1:6, y = 6:1, time = strptime("2020-09-14",format="%Y-%m-%d",tz="UTC") + 1:6)
ggplot(x) + geom_point(aes(x=x, y=y)) +facet_wrap(~time)
# Error: `scale_id` must not be `NA`
# Backtrace:
# █
# 1. ├─(function (x, ...) ...
# 2. └─ggplot2:::print.ggplot(x)
# 3. ├─ggplot2::ggplot_build(x)
# 4. └─ggplot2:::ggplot_build.ggplot(x)
# 5. └─layout$train_position(data, scale_x(), scale_y())
# 6. └─ggplot2:::f(..., self = self)
# 7. └─self$facet$train_scales(...)
# 8. └─ggplot2:::f(...)
# 9. └─ggplot2:::scale_apply(layer_data, x_vars, "train", SCALE_X, x_scales)
# Execution haltedbhogan-mitre