ggblanket icon indicating copy to clipboard operation
ggblanket copied to clipboard

New feature: support datetime

Open davidhodge931 opened this issue 2 years ago • 1 comments

davidhodge931 avatar May 08 '22 22:05 davidhodge931

lubridate::is.POSIXt

ggplot2::scale_x_datetime

davidhodge931 avatar Jul 27 '22 20:07 davidhodge931

Hi, thanks for the great package!! Is this feature coming anytime soon?

yogevherz avatar Sep 07 '22 07:09 yogevherz

I'll aim to chuck datetime in version 1.5.0 @yogevherz

I assume hms class is less needed than datetime. This also has a few more complications with making it work. But datetime is fairly straightforward

davidhodge931 avatar Sep 07 '22 09:09 davidhodge931

datetime & hms are supported for x and y vars in the development version now.

Download from github to try it out.

Not sure whether I will get around to supporting datetime in col variables..

library(nycflights13)
library(tidyverse)
library(ggblanket)

flights_0101_0102 <-
  nycflights13::flights %>% 
  filter(month == 1, day <= 2) %>% 
  group_by(time_hour = lubridate::floor_date(time_hour, "hour")) %>% 
  summarize(num_flights = n())

flights_0101_0102 %>% 
  gg_point(time_hour, num_flights) +
  theme(axis.text.x = element_text(vjust = 1))

flights_0101_0102 %>% 
  gg_col(time_hour, num_flights) +
  theme(axis.text.x = element_text(vjust = 1))

flights_0101_0102 %>% 
  gg_line(time_hour, num_flights) +
  theme(axis.text.x = element_text(vjust = 1))

davidhodge931 avatar Sep 09 '22 05:09 davidhodge931

#218

davidhodge931 avatar Sep 09 '22 06:09 davidhodge931