[R] dotplot & lattice problems: y axis values and bg color output in jpg
sundar.dorai-raj at PDF.COM
Sat Oct 23 00:36:52 CEST 2004
Paul Johnson wrote:
> I have a linux system with Fedora Core 2 and R-2.0.
> I was comparing plots made with plot() and dotplot() and discovered a
> problem. Although the dots are positioned correctly, the numerical
> labels in the dotplot y axis are not correct.
> I put copies here:
> That is the "correct" one from plot, with the higest value on y showing
> at 18.
> That is the dotplot one. The picture is basically the same, except the
> numbers on the y axis only go up to 8. But the dots are in the correct
> spots and the x axis is labeled correctly.
> On the screen, the plots have white backgrounds, but the picture from
> the dotplot turns out gray. Why is that? Sometimes, if I run another
> lattice plot in the same session, the colors change to the dark
> background, and I suppose the same trouble is happening. Isn't
> trellis.par.set() going to remain in place for all following trellis plots?
> Here's the code I used to make these 2 graphs.
> data2003<- subset(elaine1,POLCYEAR==2003)
> modall <- lm(RENUCYC~OLDCRASH,data=data2003)
> dotplot (RENUCYC~OLDCRASH, data=elaine1, xlab="ECR",
> I tried to force the ylim on the dotplot up to 18, but it just produced
> this even uglier result.
dotplot is not doing what you think it's doing. RENUCYC is being forced
to a factor with 9 levels. I think what you intending to use is xyplot.
xyplot(RENUCYC~OLDCRASH, data=elaine1, xlab="ECR",
panel.dotplot(x,y,cex=0.2) #; no need for semi-colons
As for your second question, when you call jpeg a new device is called.
You need to reset the theme after opening the device, or just use
theme = col.whitebg(),height=480,width=480)
More information about the R-help