r - How to make a density plot in ggplot2 with dates on the x-axis -
i have dataframe df
column time
contains r date objects , want plot density plot see days had activity. don't want convert timestamps, because prefer more meaningful labels in x-axis.
my attempt
here trying:
ggplot(df, aes(x = time)) + geom_density(stat="identity") + scale_x_date()
which gives error
error in as.environment(where) : 'where' missing
here output of dput(df)
:
structure(list(time = structure(c(15863, 15887, 15865, 15873, 15885, 15878), class = "date")), .names = "time", row.names = 8831395:8831400, class = "data.frame")
for reason argument stat_density causing ggplot lose way among environments set up. (at least that's "where" missing error comes from.) succeeds:
ggplot(df, aes(x = time)) + geom_density()
Comments
Post a Comment