Skip to content
This repository has been archived by the owner on Nov 12, 2020. It is now read-only.

Timezone #7

Open
maelle opened this issue Mar 2, 2016 · 0 comments
Open

Timezone #7

maelle opened this issue Mar 2, 2016 · 0 comments

Comments

@maelle
Copy link

maelle commented Mar 2, 2016

When I use the code below, the second graph shows time as if it were in UTC, but I'd like to see the IST time. Do I need to change the timezone before plotting?

library("lubridate")
library("vegalite")
library("dplyr")

dateSeq <- seq(from = ymd_hms("2015-01-23 14:22:33"),
               length = 1000,
               by = "1 min")
data <- data.frame(date = dateSeq,
                   y = rnorm(n = 1000))
data %>% head()
tz(data$date)

vegalite() %>%
  cell_size(300, 300) %>%
  add_data(data) %>%
  encode_x("date", "temporal")  %>%
  timeunit_x("yearmonthdayhoursminutesseconds")%>%
  encode_y("y", "quantitative") %>%
  axis_x(ticks=20)%>%
  mark_tick()

data <- mutate(data,
               date = force_tz(dateSeq, tz = "Asia/Kolkata"))
data %>% head()
tz(data$date)

vegalite() %>%
  cell_size(300, 300) %>%
  add_data(data) %>%
  encode_x("date", "temporal")  %>%
  timeunit_x("yearmonthdayhoursminutesseconds")%>%
  encode_y("y", "quantitative") %>%
  axis_x(ticks=20)%>%
  mark_tick()
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant