[R] axis command and excel time format
Carmen Meier
carmei3 at web.de
Fri Nov 10 12:13:43 CET 2006
>
>
> Carmen,
>
> Gabor has already given you the detail you ask for, but might try the
> following plot to see what is going wrong:
>
> plot(times(tt), x, type='l')
>
> This does not give you the EXACT control of the axis you asked for,
> but this simple plot command gives you a fairly nice result. It
> illustrates that your code is failing becasue you are plotting x
> against the index of x rather than plotting x against time. At least
> this is what I think the misunderstanding is.
>
Thank you Robert,
this is nearly what I need, but my problem is that I need an empty
window with axes.
I am able to build this with any data but not with the time axis.
I need for a special issue only horizontal lines with different colors
and arrows, which will be inserted from a function.
Maybe you could explain me what's the difference between
library(zoo)
library(chron)
time <-
c("2:25:00","2:26:00","2:27:00","2:28:00","2:29:00","2:30:00","2:31:00",
"2:32:00","2:33:00","2:34:00","2:35:00","2:36:00","2:37:00","2:38:00",
"2:39:00","2:40:00","2:41:00","2:42:00","2:43:00","2:44:00","2:45:00",
"2:46:00","2:47:00","2:48:00","2:49:00","2:50:00","2:51:00","2:52:00",
"2:53:00","2:54:00","2:55:00","2:56:00","2:57:00","2:58:00","2:59:00",
"3:00:00","3:01:00","3:02:00","3:03:00","3:04:00","3:05:00","3:06:00",
"3:07:00","3:08:00","3:09:00","3:10:00","3:11:00","3:12:00","3:13:00",
"3:14:00")
y <- c(0,10)
plot(times(time), y, type='n')
- error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y'
lengths differ
- the error is only with type='n' and not with type='l'
and the example without errors
library(zoo)
library(chron)
time <-
c("2:25:00","2:26:00","2:27:00","2:28:00","2:29:00","2:30:00","2:31:00",
"2:32:00","2:33:00","2:34:00","2:35:00","2:36:00","2:37:00","2:38:00",
"2:39:00","2:40:00","2:41:00","2:42:00","2:43:00","2:44:00","2:45:00",
"2:46:00","2:47:00","2:48:00","2:49:00","2:50:00","2:51:00","2:52:00",
"2:53:00","2:54:00","2:55:00","2:56:00","2:57:00","2:58:00","2:59:00",
"3:00:00","3:01:00","3:02:00","3:03:00","3:04:00","3:05:00","3:06:00",
"3:07:00","3:08:00","3:09:00","3:10:00","3:11:00","3:12:00","3:13:00",
"3:14:00")
y <- c(0,10)
plot(times(time), y, type='l')
It is not the type='n' every other combination of data types which i
tried was working with the no plot option
y <- c(0,10)
z <- c(0,10)
plot(z, y, type='n')
Carmen
More information about the R-help
mailing list