我似乎無法在ggplot2 0.9.0 documentation,0.9.0轉換指南或搜索中找到相關信息。ggplot 0.9.0中scale_datetime()的適當時區參數語法是什麼?
我想在較早的版本中,您會將tz
參數添加到scale_x_datetime
。我試過在scale_x_datetime
的不同位置放置tz
參數,但不斷收到錯誤。見下文。
我的日期時間數據格式爲GMT時區爲POSIXct
格式。當我繪製它時,座標軸和中斷點顯示我的當地時區(EST)。我希望這個軸上的午夜在GMT時區是午夜。在ggplot2 0.9.0中做這件事的正確方法是什麼?
attributes(data$date)
# $class
# [1] "POSIXct" "POSIXt"
# $tzone
# [1] "GMT"
ggplot(data, aes(x = date)) +
geom_line(aes(y = count)) +
scale_x_datetime(breaks = date_breaks("1 day"),
labels = date_format("%d", tz = "UTC"))
# Error in date_format("%d", tz = "UTC") : unused argument(s) (tz = "UTC")
ggplot(data, aes(x = date)) +
geom_line(aes(y = count)) +
scale_x_datetime(breaks = date_breaks("1 day", tz = "UTC"),
labels = date_format("%d"))
# Error in date_breaks("1 day", tz = "UTC") :
# unused argument(s) (tz = "UTC")
ggplot(data, aes(x = date)) +
geom_line(aes(y = count)) +
scale_x_datetime(breaks = date_breaks("1 day"),
labels = date_format("%d"),
tz = "UTC")
# Error in continuous_scale(aesthetics, "datetime", identity, breaks = breaks, :
# unused argument(s) (tz = "UTC")