Set ggplot2 Axis Limits by Date Range (Example) | Change Scale | scale_x_date() & as.Date() Function

preview_player
Показать описание
R code of this video:

by = "day",
y = 1:10)

library("ggplot2")

ggp <- ggplot(data, aes(x, y)) + # ggplot2 plot with default axis
geom_point()
ggp

library("scales")

ggp + # Set date range as limits
scale_x_date(limits = as.Date(c("2022-01-03", "2022-01-07")))

Follow me on Social Media:

Рекомендации по теме
Комментарии
Автор

Hi Sir! I need help, how do I format the format of the x axis from dd/mm/yyyy hh:mm:ss to dd/mm/yyyy hh at the bottom of the graph?

DIYJack
join shbcf.ru