I want to plot 2 integer[] vectors:a,b onto a factor[] vector:c, using the following code:
plot(c,a,type='l',col="blue",xlab="foo",ylab="bar")
lines(c,b,col="red")
Vector c contains strings such as: “2007-09-30 – 2007-10-06”.
I am facing two problems using this method:
- The first call plots the vector as points, even though I have specified
type='l'and ignores the argumentcol="blue". - Vector c is rather large and R is trying to fit every element as a discrete point on the x-axis, which is rather hideous.
The rendered output looks like this:

Does anyone have suggestions on how to fix my problems?
Thank you for your help!
Sorry, no time for an example right now, but here’s my feeble advice:
convert your
factor,cto aDateclass, at least for plotting. see?Date