On Fri, Feb 3, 2012 at 5:05 AM, ikuzar <raz...@hotmail.fr> wrote: > Hello, > I'd like to know how to plot several curves in the same frame (1curve = > 1line=1day). > For instance (csv file): > > 2012-02-01 01:00:00; 2100 > 2012-02-01 02:00:00; 2200 > ... > 2012-02-01 23:00:00; 2500 > 2012-02-02 01:00:00; 1000 > 2012-02-02 02:00:00; 1500 > ... > 2012-02-02 23:00:00; 1700 > > Here, I have to plot 2 curves in the same frame: 1 for 2012-02-01 (on the > first line) and 1 for 2012-02-02 (on the second) >
Assuming you want to plot the numbers against time for each day: Lines <- "2012-02-01 01:00:00; 2100 2012-02-01 02:00:00; 2200 2012-02-01 23:00:00; 2500 2012-02-02 01:00:00; 1000 2012-02-02 02:00:00; 1500 2012-02-02 23:00:00; 1700" library(zoo) library(chron) procTime <- function(x) times(sub(";", "", x)) z <- read.zoo(text = Lines, split = 1, index = 2, FUN = procTime) cols <- rainbow(ncol(z)) plot(z, screen = 1, col = cols) legend("bottomright", leg = colnames(z), col = cols, lty = 1) -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ R-help@r-project.org mailing list 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.