[R] Resolv: Axis whitout all the row, that contains time
Hello, with the new column all works fine, i can now select the break and format for the x axis. Thank's François-Marie On Sun, 14 Feb 2021 14:24:22 + Rui Barradas wrote: > Hello, > > Merci pour les donnés, c'est beaucoup mieux comme ça. > > Create a column of class "POSIXct" > > > listeMesuresPropres$DateHeure <- with(listeMesuresPropres, > as.POSIXct(paste(Date., Heure.))) > > > and then plot with this new column, DateHeure as x axis variable. > > Can you post the entire ggplot code, not just the scale_x_datetime > instruction but the rest of the plotting code? > > > Hope this helps, > > Rui Barradas > > > Às 13:25 de 14/02/21, Informatique escreveu: > > Hello, > > Thank's for your help. > > > > i when i try this one > > geom_line() + > > scale_x_datetime(date_breaks = "20 secs", date_labels = "H:%M:%S") > > geom_point() > > > > > > i have an error : > > Erreur : Invalid input: time_trans works with objects of class POSIXct > > only > > > > it's the reason i have try the scale_x_time after. > > > > The result of > dput(head(listeMesuresPropres, 20)) is > > > > dput(head(listeMesuresPropres, 20)) # or 30 > > structure(list(Date. = structure(c(18666, 18666, 18666, 18666, > > 18666, 18666, 18666, 18666, 18666, 18666, 18666, 18666, 18666, > > 18666, 18666, 18666, 18666, 18666, 18666, 18666), class = "Date"), > > Heure. = c("10:24:00", "10:24:05", "10:24:10", "10:24:15", > > "10:24:20", "10:24:25", "10:24:30", "10:24:35", "10:24:40", > > "10:24:45", "10:24:50", "10:24:55", "10:25:00", "10:25:05", > > "10:25:10", "10:25:15", "10:25:20", "10:25:25", "10:25:30", > > "10:25:35"), U12.RMS.MIN.1.2.période = structure(c(19L, > > 18L, 18L, 20L, 20L, 20L, 23L, 3L, 19L, 16L, 12L, 26L, 14L, > > 28L, 16L, 15L, 13L, 15L, 15L, 27L), .Label = c("", "401,1", > > "401,2", "401,5", "401,9", "402", "403", "403,1", "403,2", > > "403,3", "403,4", "403,5", "403,6", "403,7", "403,8", "403,9", > > "404", "404,1", "404,2", "404,3", "404,4", "404,5", "404,6", > > "404,7", "404,8", "404,9", "405", "405,2", "405,3", "V"), class = > > "factor"), > > U12.RMS = structure(c(14L, 13L, 12L, 14L, 14L, 14L, 17L, > > 10L, 13L, 11L, 8L, 9L, 10L, 10L, 11L, 12L, 9L, 10L, 9L, 9L > > ), .Label = c("", "404,7", "404,8", "404,9", "405", "405,1", > > "405,2", "405,3", "405,4", "405,5", "405,6", "405,7", "405,8", > > "405,9", "406", "406,1", "406,2", "406,3", "V"), class = "factor"), > > U12.RMS.MAX.1.2.période = structure(c(14L, 12L, 11L, 13L, > > 12L, 12L, 17L, 9L, 12L, 11L, 9L, 8L, 8L, 8L, 10L, 11L, 12L, > > 8L, 9L, 7L), .Label = c("", "406,5", "406,6", "406,7", "406,8", > > "406,9", "407", "407,1", "407,2", "407,3", "407,4", "407,5", > > "407,6", "407,7", "407,8", "407,9", "408", "408,1", "V"), class = > > "factor"), > > U23.RMS.MIN.1.2.période = structure(c(19L, 16L, 17L, 17L, > > 17L, 17L, 18L, 2L, 27L, 16L, 12L, 12L, 23L, 14L, 15L, 17L, > > 12L, 24L, 12L, 14L), .Label = c("", "400,7", "400,8", "401,5", > > "401,6", "402,4", "402,8", "402,9", "403", "403,1", "403,2", > > "403,3", "403,4", "403,5", "403,6", "403,7", "403,8", "403,9", > > "404", "404,2", "404,3", "404,5", "404,6", "404,7", "404,9", > > "405", "405,1", "405,6", "V"), class = &quo
Re: [R] Axis whitout all the row, that contains time
ar. = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 7L, 8L, 8L, 8L, 9L, 8L, 4L, 3L, 3L, 23L, 15L, 13L, 14L), .Label = c("", "-7,6", "0", "1,9", "1110", "145,6", "2,3", "2,4", "2,5", "328,3", "347,2", "43,2", "446", "446,2", "446,8", "447", "467,3", "468,8", "469,6", "471,2", "476,2", "5,9", "502,5", "76,1", "865,6", "866,5", "866,9", "867,1", "868,6", "898", "901,3", "902,7", "903,7", "905,3", "var"), class = "factor"), Q3..var. = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 19L, 15L, 17L, 16L), .Label = c("", "-0,6", "0", "1054", "136,9", "318,4", "325,3", "41,1", "430,8", "431,4", "431,6", "432,1", "444,3", "444,5", "445,4", "445,5", "445,9", "471,7", "494", "75,6", "844,4", "846,2", "846,3", "847,4", "847,8", "859,1", "861,1", "861,5", "862,6", "865,4", "866,9", "var"), class = "factor"), QT..var. = structure(c(12L, 13L, 14L, 14L, 12L, 12L, 12L, 5L, 4L, 5L, 4L, 4L, 3L, 6L, 11L, 13L, 32L, 30L, 29L, 28L), .Label = c("", "-47,9", "-50,2", "-50,3", "-50,4", "-50,9", "-52,3", "-52,4", "-52,5", "-52,6", "-52,8", "-52,9", "-53", "-53,1", "-53,3", "-53,5", "-53,6", "-53,7", "-53,8", "-53,9", "-54", "-61,2", "1248", "1250", "1251", "1252", "1261", "1262", "1264", "1265", "1348", "1421", "169,8", "2485", "2488", "2489", "2490", "2502", "2503", "2504", "2507", "2511", "2536", "3117", "359,3", "81,6", "897,2", "930,9", "var"), class = "factor"), S1..VA. = structure(c(4L, 5L, 7L, 6L, 8L, 8L, 9L, 10L, 12L, 15L, 11L, 14L, 13L, 13L, 13L, 16L, 31L, 59L, 58L, 57L), .Label = c("", "1024", "1056", "106,7", "107,7", "108", "108,2", "108,3", "109,2", "109,4", "109,5", "109,6", "109,9", "110,1", "110,2", "110,5", "111,3", "111,4", "112,7", "112,9", "113,5", "113,8", "113,9", "114", "114,1", "114,2", "114,3", "114,4", "114,5", "114,8", "1201", "1225", "1460", "1463", "1465", "1467", "1471", "151,1", "1530", "1532", "1535", "1541", "1549", "1958", "2161", "2164",
Re: [R] 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 + Rui Barradas 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 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Axis whitout all the row, that contains time
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 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.