R helpers, I am trying to add labels to my graphs. I have a Perl Program which generates thousands of R files like the one attached. My data files have 2 - 8 columns in them. The first column of every data file is a header (Time) - which I want to have plotted against everything else. My current formula just plots each column, which is fine, yet at the bottom for my labels I wind up with numbers. What I would like to do is have R grab the Time label in increments of 144 data points and use that to label my X-axis instead of just plain numbers. (Each data file has about 4400 columns). I can kind of have R lable the bottom by chaning my plot to "plot(usr.cpu ~ Time), yet then the graphs take much, much longer to generate. Worst case, I will use "plot(usr.cpu ~ Time)" - yet, anyone know why this would take a very, very long time? Any ideas? Thanks, Tony Tony Vargas Cisco Systems Engineering Computing Services (408) 525-4113 tvargas at cisco.com -------------- next part -------------- A non-text attachment was scrubbed... Name: wbu.vob5.Feb.2003.sys.cpu.lines.png Type: application/octet-stream Size: 7270 bytes Desc: Url : https://stat.ethz.ch/pipermail/r-help/attachments/20030225/90cdba26/wbu.vob5.Feb.2003.sys.cpu.lines.obj
Tony Vargas wrote:> R helpers, > > I am trying to add labels to my graphs. I have a Perl Program which > generates thousands of R files like the one attached. > > My data files have 2 - 8 columns in them. The first column of every data > file is a header (Time) - which I want to have plotted against everything > else. My current formula just plots each column, which is fine, yet at > the bottom for my labels I wind up with numbers. What I would like to do > is have R grab the Time label in increments of 144 data points and use > that to label my X-axis instead of just plain numbers. (Each data file > has about 4400 columns).You have somehow confused columns and rows. Anyway, you might want to use something like plot(..., xaxt="n") temp <- seq(1, length(Time), by = 144) axis(1, at = temp, labels = Time[temp]) Uwe Ligges> I can kind of have R lable the bottom by chaning my plot to "plot(usr.cpu > ~ Time), yet then the graphs take much, much longer to generate. > > Worst case, I will use "plot(usr.cpu ~ Time)" - yet, anyone know why this > would take a very, very long time? > > Any ideas? > > Thanks, > > Tony > > Tony Vargas > Cisco Systems > Engineering Computing Services > (408) 525-4113 > tvargas at cisco.com
On Tue, 25 Feb 2003, Tony Vargas wrote:> R helpers, > > I am trying to add labels to my graphs. I have a Perl Program which > generates thousands of R files like the one attached. > > My data files have 2 - 8 columns in them. The first column of every data > file is a header (Time) - which I want to have plotted against everything > else. My current formula just plots each column, which is fine, yet at > the bottom for my labels I wind up with numbers. What I would like to do > is have R grab the Time label in increments of 144 data points and use > that to label my X-axis instead of just plain numbers. (Each data file > has about 4400 columns).Call plot() with xaxt="n", then call axis() to add the labels you want. You can use plot.POSIXct as a model.> I can kind of have R lable the bottom by chaning my plot to "plot(usr.cpu > ~ Time), yet then the graphs take much, much longer to generate.I presume that Time is a character variable, so a lot of conversion is goin on: but we are short on details here.> Worst case, I will use "plot(usr.cpu ~ Time)" - yet, anyone know why this > would take a very, very long time?-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595
Uwe, Thanks for your help. The solution solved most of my problem and was consistent with the other responses I got back. The solution below gives me tick marks at 144 point intervals, yet when I try to get the information located at the point, I get the number position back, not the date (02/01/03,00:50). Any ideas? In addition, thanks for your help so far, Tony Tony Vargas Cisco Systems Engineering Computing Services (408) 525-4113 tvargas at cisco.com On Wed, 26 Feb 2003, Uwe Ligges wrote:> Tony Vargas wrote: > > R helpers, > > > > I am trying to add labels to my graphs. I have a Perl Program which > > generates thousands of R files like the one attached. > > > > My data files have 2 - 8 columns in them. The first column of every data > > file is a header (Time) - which I want to have plotted against everything > > else. My current formula just plots each column, which is fine, yet at > > the bottom for my labels I wind up with numbers. What I would like to do > > is have R grab the Time label in increments of 144 data points and use > > that to label my X-axis instead of just plain numbers. (Each data file > > has about 4400 columns). > > You have somehow confused columns and rows. Anyway, you might want to > use something like > > plot(..., xaxt="n") > temp <- seq(1, length(Time), by = 144) > axis(1, at = temp, labels = Time[temp]) > > Uwe Ligges > > > > I can kind of have R lable the bottom by chaning my plot to "plot(usr.cpu > > ~ Time), yet then the graphs take much, much longer to generate. > > > > Worst case, I will use "plot(usr.cpu ~ Time)" - yet, anyone know why this > > would take a very, very long time? > > > > Any ideas? > > > > Thanks, > > > > Tony > > > > Tony Vargas > > Cisco Systems > > Engineering Computing Services > > (408) 525-4113 > > tvargas at cisco.com > > >