Skip to content

timezone parameter for scale_x_datetime has no effect #4007

Closed
@swebs

Description

@swebs

I am trying to use the timezone parameter to scale_x_datetime to control how the tick labels are displayed, but I can't get it to work. Changing the timezone does not seem to make a difference to plot output. This probably applies equally to scale_y_datetime. Potentially I am not using the correct syntax and the documentation could be expanded.

library(tidyverse)
library(lubridate)

plotdata <- tribble(
  ~t_stamp, ~value,
  "2019-08-17T06:00:00", 1,
  "2019-08-17T07:00:00", 2,
  "2019-08-17T08:00:00", 3
)

plotdata <- plotdata %>% 
  mutate(t_stamp=force_tz(ymd_hms(t_stamp),tzone="US/Mountain"))

ggplot(plotdata) +
  geom_point(mapping=aes(x=t_stamp, y=value)) +
  scale_x_datetime(timezone = "US/Mountain")

ggplot(plotdata) +
  geom_point(mapping=aes(x=t_stamp, y=value)) +
  scale_x_datetime(timezone = "US/Eastern")

# both plots are the same

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorscales 🐍

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions