facet_grid_sc does not seem to work with dates on x axis.
Closed this issue · 2 comments
TheDohn commented
For just numerical data facet_grid and facet_grid_sc seem to work fine (i.e. both of these plots work):
test_df <-
tibble( date = seq(1, 16),
y1 = rnorm(n = 16),
y2 = seq(1, 16)
) %>%
melt(id.vars = c('date')) %>%
{.}
ggplot(data = test_df, aes( x = date, y = value)) +
geom_line() +
facet_grid(variable~.) +
geom_blank()
scales_y <- list(
`y1` = scale_y_continuous(),
`y2` = scale_y_continuous()
)
ggplot(data = test_df, aes( x = date, y = value)) +
geom_line() +
facet_grid_sc(rows = vars(variable), scales = list(y = scales_y )) +
geom_blank()
But facet_grid_sc does not work for date data on the x axis (i.e. the second plot fails):
test_df <-
tibble( date = seq(as.Date('2015-09-15'), as.Date('2015-09-30'), by = "1 days"),
y1 = rnorm(n = 16),
y2 = seq(1, 16)
) %>%
melt(id.vars = c('date')) %>%
{.}
ggplot(data = test_df, aes( x = date, y = value)) +
geom_line() +
facet_grid(variable~.) +
geom_blank()
scales_y <- list(
`y1` = scale_y_continuous(),
`y2` = scale_y_continuous()
)
ggplot(data = test_df, aes( x = date, y = value)) +
geom_line() +
facet_grid_sc(rows = vars(variable), scales = list(y = scales_y )) +
geom_blank()
TheDohn commented
My apologies for the careless issue post. Thank you for the reply.