[R-SIG-Finance] Plot.zoo does not take vector parameter for lwd
Gabor Grothendieck
ggrothendieck at gmail.com
Fri Jul 24 01:44:21 CEST 2009
On Thu, Jul 23, 2009 at 4:17 PM, Sean Carmody<seancarmody at gmail.com> wrote:
> It seems to me that plot.zoo does not treat the linewidth (lwd)
> parameter as a vector and instead only uses the first value. Consider
> the following example:
>
> x <- zoo(data.frame(X=runif(12), Y=rnorm(12),
> x=runif(12)),as.Date(paste("2009",1:12,1,sep="-")))
> plot(x, plot.type="single", lwd=c(1,2,3))
>
> The resulting plot has lines all of the same width. In contrast, the
> col argument work as expected, for example:
>
> plot(x,plot.type="single", col=rainbow(3))
>
> Is there any way to get around this without plotting each line separately?
OK. plot.zoo does not implement every possible parameter in
full generality but since you ask about that one specifically a
fix has been added to the devel version.
library(zoo)
source("http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/R/plot.zoo.R?rev=603&root=zoo")
plot(zoo(matrix(1:4, 2)), lwd = 1:2)
>
> On a related subject, I found this post
> http://tolstoy.newcastle.edu.au/R/e6/help/09/01/1297.html which
> explains how to change the plot.zoo so that no bounding box is drawn.
> It would seem a lot easier if plot.zoo would actually use a bty
> argument that is passed. Is there any reason why this is not possible?
Here is an easier way:
opar <- par(bty = "n")
plot(zoo(1:5))
More information about the R-SIG-Finance
mailing list