简体   繁体   中英

plotting POSIXct values in R

Im trying to plot datetimes of customer visits using a histogram but for some reason my plots are producing scientific notation for the y axis. My code is as follows:

hist(tsData, breaks = "months", plot = TRUE, freq = FALSE,
     start.on.monday = TRUE, format)

hist(tsData, breaks = "hours", plot = TRUE, freq = FALSE,
     start.on.monday = TRUE, format)

Which produce the following plots respectively,

情节 1

情节2

My POSIXct values are in the format: "2018-03-13 10:18:14" for every visit. Am I plotting these date times incorrectly?

Without seeing your data, I cannot tell for certain, but your horizontal axes seem to suggest you are plotting the date-times correctly.

As for your vertical axis, it is showing scientific notation because the density values are very small. In your first plot, 1.0e-08 is the same as 0.00000001 . It may be that the format you are passing to hist is setting the y-axis to scientific notation. Regardless, neither 1.0e-08 nor 0.00000001 are very readable. Since the probability densities are so small, your histograms may be more intelligible if you set freq = TRUE to show the counts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM