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) Thanks for your help -- View this message in context: http://r.789695.n4.nabble.com/how-to-plot-several-curves-in-the-same-frame-tp4354165p4354165.html Sent from the R help mailing list archive at Nabble.com.
I use RStudio. I'd like to plot these curves in a new frame (out of RStudio) -- View this message in context: http://r.789695.n4.nabble.com/how-to-plot-several-curves-in-the-same-frame-tp4354165p4354261.html Sent from the R help mailing list archive at Nabble.com.
Your data appears to have two different dates. What is the x-axis of the data you want plotted? Is it just going to the the hours in a day? On Fri, Feb 3, 2012 at 5:05 AM, ikuzar <razuki at 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) > > Thanks for your help > > -- > View this message in context: http://r.789695.n4.nabble.com/how-to-plot-several-curves-in-the-same-frame-tp4354165p4354165.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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.-- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it.
On Fri, Feb 3, 2012 at 5:05 AM, ikuzar <razuki at 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
Ok. I really have 15 days to plot, the x-axis is the date, and it is going to the MINUTES in a day. I have to plot a curve per day (so 15 plots) The real data is like this: 2012-02-01 00:01:00; 2100 2012-02-01 02:02:00; 2200 ... 2012-02-15 23:58:00; 2400 2012-02-15 23:59:00; 2400 -- View this message in context: http://r.789695.n4.nabble.com/how-to-plot-several-curves-in-the-same-frame-tp4354165p4354523.html Sent from the R help mailing list archive at Nabble.com.