uncoast-unconf / uu-2019

Materials for the 2019 uncoast unconference
11 stars 4 forks source link

Plotting time #10

Open ellisvalentiner opened 5 years ago

ellisvalentiner commented 5 years ago

There are a few things I run into when I am plotting time that are much easier when plotting datetime/date data. This pain points might be specific to my work but maybe someone else is interested in these as well:

  1. ggplot doesn't like to use scale_*_time with data from strftime, you have to use something like lubridate::hms(strftime(x, format = "%X")) or hms::as.hms(strftime(x, format = "%X"))
  2. scale_*_time limits are a numeric vector (e.g. limits = c(0, 86400) to specify the full 24-hour day) which is not very human-readable. However for datetime/dates you can specify limits like limits = c("2019-04-14", "2019-04-16"). It would nice if there was something similar for time (e.g. limits = c("12:00 AM", "11:59 PM").
  3. I usually construct scale_*_time breaks with something like seq(0, 86400, 60*60*4) (every 4 hours) but scale_*_date/scale_*_datetime allows the user to specify breaks as a string giving the distance between breaks (e.g. 2 weeks). It would be nice if there was something similar for time (e.g. 4 hours).
  4. Every time I plot time I often have to go look up the POSIX codes and write a custom function in order to get nice formatting (e.g. show "4 PM" instead of "16:00:00").

One suggestion is to write documentation/examples for how to do each of these things.

nooreendabbish commented 5 years ago

Hi Ellis, I'm interested in working on your issue... checking out the pain points now. Have you started a repository to work on this?

ellisvalentiner commented 5 years ago

Perhaps we can start a repository and invite Ian

On Mon, Apr 15, 2019 at 10:23 AM Nooreen Dabbish notifications@github.com wrote:

Hi Ellis, I'm interested in working on your issue... checking out the pain points now. Have you started a repository to work on this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/uncoast-unconf/uu-2019/issues/10#issuecomment-483297676, or mute the thread https://github.com/notifications/unsubscribe-auth/AJeNu5-eGzDBuacz8tohzo40DTxH1prgks5vhJlZgaJpZM4bmQii .

ijlyttle commented 5 years ago

Just to note that I had a great conversation with @ellisvalentiner on this - it's a super-interesting topic - we all just need more... time...