[R] Issue displaying DATES on a plot with two ordinates

clair.crossupton at googlemail.com clair.crossupton at googlemail.com
Thu Sep 10 12:44:14 CEST 2009


Dear all,

I am having an issue with displaying the dates on a plot with two
ordinates (i.e. two differently scaled y-axes). Instead of dates
appearing on the x-axis I am instead seeing a string of numbers
(14460, 14465, 14470 and 14475).

example R code:

library(plotrix)
x.Left <- as.Date(c('2009-08-04', '2009-08-08', '2009-08-11',
'2009-08-15', '2009-08-18'), format="%Y-%m-%d")
x.Right <- as.Date(c('2009-08-05', '2009-08-09', '2009-08-12',
'2009-08-16', '2009-08-19'), format="%Y-%m-%d")
y.Left <- c(70.13, 75.1, 74.35, 78.9, 80.92)
y.Right <- c(35, 45, 50, 47, 53)
twoord.plot(x.Left, y.Left, x.Right, y.Right, xlab="Date", ylab="Trend
1", rylab="Trend 2", lwd=2, lcol='blue')


Thanks in advance for any help,
C.C.

P.S. I am aware of the criticisms of these sort of graphs, but they
are pretty. Also, they seem to be used a lot in meetings i've attended
recently.


Windows Vista
> sessionInfo()
R version 2.9.2 (2009-08-24)
i386-pc-mingw32

locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.
1252;LC_MONETARY=English_United Kingdom.
1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods
base

other attached packages:
[1] plotrix_2.7




More information about the R-help mailing list