Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using time on x axis (POSIXct) #17

Closed
jcpsantiago opened this issue Aug 2, 2017 · 6 comments
Closed

Using time on x axis (POSIXct) #17

jcpsantiago opened this issue Aug 2, 2017 · 6 comments

Comments

@jcpsantiago
Copy link

Not sure if this is by design, but ggpubr won't format axis ticks correctly when given a datetime (POSIXct) column as input.

The fulldate column used in the plots below is of class

> class(n_hours$fulldate)
[1] "POSIXct" "POSIXt" 

and has the format "2017-01-01 20:45:00 UTC"

Plot made with ggpubr:

n_hours %>%
  ggline(x = "fulldate", y = "value",
         group = "ID", add = "mean",
         x.text.angle = 25)

rplot

and the same data directly with ggplot:

n_hours %>%
  ggplot(aes(x = fulldate, y = value, group = ID)) +
  stat_summary(aes(group = ID), geom = "line", fun.y = mean, size = 0.6)

rplot01

kassambara added a commit that referenced this issue Aug 2, 2017
@kassambara
Copy link
Owner

Should work now, thanks.

@jcpsantiago
Copy link
Author

Thanks for looking into it! It's still not working for me with your latest commit. ggpubr is still converting the data to numeric.

@kassambara
Copy link
Owner

would you please provide a reproducible R script with a demo data set?

To include data in a question, use dput() to generate the R code to recreate it. For example, to recreate the mtcars dataset in R, I’d perform the following steps:

  1. Run dput(mtcars) in R
  2. Copy the output
  3. In your reproducible script, type mtcars <- then paste.

Thanks

@jcpsantiago
Copy link
Author

Here you go:
rep_script.txt

kassambara added a commit that referenced this issue Aug 2, 2017
kassambara added a commit that referenced this issue Aug 2, 2017
@kassambara
Copy link
Owner

Thank you.

Should work now. dplyr >= 0.7.1 required

@jcpsantiago
Copy link
Author

Great! Thank you man ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants