Rex_Bryan@urscorp.com
2003-Jan-13 02:16 UTC
[R] Fw: Plotting text-string real_date names at excel_date positions.
How do I post text-string dates along the x-axis instead of the excel_date position values? I would like to plot a time-series of chemical values changing with time The first column is the internal date from excel. This should be the x-axis position of a graph of the plotted data. The second column is a text-string of date. This should be what is posted (instead of the excel_date). The third column is the chemical data and this should be the position of a point on the y-axis. A line needs to connect the points but should break at the NA. excel_date real_date chemical 36234 15-Mar-99 1.6 36302 22-May-99 0.195 36395 23-Aug-99 4.9 36475 11-Nov-99 NA 36593 8-Mar-00 3.58 Rex
Roger Peng
2003-Jan-13 04:18 UTC
[R] Fw: Plotting text-string real_date names at excel_date positions.
You probably want to use the `axes = FALSE' argument to plot and then construct the axes yourself with the axis() function. Perhaps something like (using the real variable names, of course): attach("mydataset") plot(exceldate, chemical, axes = FALSE, frame.plot = TRUE, type = "l") axis(2) axis(1, exceldate, realdate) This may produce an x-axis that's too crammed so you'll have to fiddle with it so that the labels are nicely spaced. Maybe something like idx <- seq(1, length(exceldate), by = 2) axis(1, exceldate[idx], realdate[idx]) -roger _______________________________ UCLA Department of Statistics rpeng at stat.ucla.edu http://www.stat.ucla.edu/~rpeng On Sun, 12 Jan 2003, Rex_Bryan at urscorp.com wrote:> How do I post text-string dates along the x-axis instead of the excel_date > position values? > > I would like to plot a time-series of chemical values changing with time > The first column is the internal date from excel. This should be the x-axis > position of a graph > of the plotted data. > > The second column is a text-string of date. This should be what is posted > (instead of the excel_date). > The third column is the chemical data and this should be the position of a > point on the y-axis. > A line needs to connect the points but should break at the NA. > > excel_date real_date chemical > 36234 15-Mar-99 1.6 > 36302 22-May-99 0.195 > 36395 23-Aug-99 4.9 > 36475 11-Nov-99 NA > 36593 8-Mar-00 3.58 > > Rex > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/r-help >