Axis whitout all the row, that contains time
Hello, the time are in the first table like that : 10:24:00 and i use this for listeMesuresPropres$Heure. <- hms(listeMesuresPropres$Heure. after time ar like that : 10H 24M 0S and when i use with ggplot scale_x_time(breaks = "20 secs",labels = "%H:%M:%S") it have the graphics but noting write on the X axis. I think it a problem with the format of the time, because if i try a ggplot without scale_x_time i don't have anything on the graphic. Thank's Fran?ois-Marie BILLARD On Fri, 12 Feb 2021 18:24:35 +0000
Rui Barradas <ruipbarradas at sapo.pt> wrote:
Hello,
In order to select every 20 s, set the date_breaks = "20 secs", not the
breaks.
The axis labels are also formatted, with date_labels, standard datetime
format strings are used for this. And rotated, not part of the question.
# Create some data
set.seed(2021)
time <- seq(as.POSIXct("2021-02-11"), as.POSIXct("2021-02-11 00:29:59"),
by = "1 secs")
y <- cumsum(rnorm(length(time)))
df1 <- data.frame(time, y)
# Plot the data
library(ggplot2)
ggplot(df1, aes(time, y)) +
geom_line() +
scale_x_datetime(date_breaks = "20 secs", date_labels = "%M:%S") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1,
size = 5))
Hope this helps,
Rui Barradas
?s 15:05 de 12/02/21, Informatique escreveu:
Hello, i'm using Rstudio from a few day, and i have some information in a CVS file, take every five second, format of the time is HH:MM:SS. I use the hour on the X axis, but i don't want having all the time print. For example only every 10 values. I think it will be possible with scale_x_datetime(breaks = date_breaks(XXX) but i don't understand how select every 20 s. Thank's for your help Fran?ois-marie BILLARD
Informatique <informatique at billard-francois-marie.eu>