scale_x_datetime

ARGUMENTS
no arguments
without the scale
date_breaks
date_labels
date_minor_breaks
breaks
labels
guide
expand
limits
minor_breaks
name
position
sec.axis

set.seed(34)
df <- data.frame(date = seq(as.POSIXct('2012-02-09 00:00', tz = 'CET'),
                            as.POSIXct('2012-02-11 00:00', tz = 'CET'),
                            by = '60 min'), heart_rate = runif(49, min = 60, max = 180))
ggplot(df, aes(x = date, y = heart_rate)) +
  geom_line() +
  scale_x_datetime()
ggplot2tor image

ggplot2tor

Handmade tutorials to help you master ggplot2. Each tutorial provides a step-by-step guide that teaches you how to create visualizations that go beyond the basics of ggplot2.

Creator and author

I am an educational scientist and instructional designer with a curiosity for web development and data visualization. Find me on my personal homepage.