Hello all, I'm plotting several graphs with a for-loop with a code: par(mfrow=c(3,4)) for(i in levels(fHCGB$code)) with(subset(fHCGB,code==i), plot(pooledPlateIntra, type="b", ylim=ylim, xlab=code, ylab="CV%")) With which I have no problems.. However I need to add lines to all of these 12 plots, but I cannot get it to work. I've tried for example par(mfrow=c(3,4)) for(i in levels(fHCGB$code)) with(subset(fHCGB,code==i), plot(pooledPlateIntra, type="b", ylim=ylim, xlab=code, ylab="CV%") points(fHCGB$limitVarC,type="b", col="green"))) But run into errors. How can the lines be added? Taija Saanisto Biostatistician Quality assurance, Process Development PerkinElmer Life and Analytical Sciences / Wallac Oy Phone: +358-2-2678 741 [[alternative HTML version deleted]]
Dear Taija,
You want lines but use points? Try
for(i in levels(fHCGB$code)){
with(subset(fHCGB,code==i),
plot(pooledPlateIntra, type="b", ylim=ylim, xlab=code,
ylab="CV%")
lines(fHCGB$limitVarC, col="green"))
}
Cheers,
Thierry
------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be
www.inbo.be
Do not put your faith in what statistics say until you have carefully
considered what they do not say. ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney
> -----Oorspronkelijk bericht-----
> Van: r-help-bounces op stat.math.ethz.ch
> [mailto:r-help-bounces op stat.math.ethz.ch] Namens Saanisto, Taija
> Verzonden: dinsdag 5 juni 2007 13:12
> Aan: r-help op stat.math.ethz.ch
> Onderwerp: [R] Lines to plots with a for-loop
>
> Hello all,
>
> I'm plotting several graphs with a for-loop with a code:
>
> par(mfrow=c(3,4))
>
> for(i in levels(fHCGB$code)) with(subset(fHCGB,code==i),
> plot(pooledPlateIntra, type="b", ylim=ylim, xlab=code,
ylab="CV%"))
>
>
> With which I have no problems.. However I need to add lines
> to all of these 12 plots, but I cannot get it to work. I've
> tried for example
>
> par(mfrow=c(3,4))
>
> for(i in levels(fHCGB$code)) with(subset(fHCGB,code==i),
> plot(pooledPlateIntra, type="b", ylim=ylim, xlab=code,
> ylab="CV%") points(fHCGB$limitVarC,type="b",
col="green")))
>
> But run into errors. How can the lines be added?
>
> Taija Saanisto
> Biostatistician
> Quality assurance, Process Development
> PerkinElmer Life and Analytical Sciences / Wallac Oy
> Phone: +358-2-2678 741
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help op stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
Saanisto, Taija wrote:> Hello all, > > I'm plotting several graphs with a for-loop with a code: > > par(mfrow=c(3,4)) > > for(i in levels(fHCGB$code)) with(subset(fHCGB,code==i), > plot(pooledPlateIntra, type="b", ylim=ylim, xlab=code, ylab="CV%")) > > > With which I have no problems.. However I need to add lines to all of > these 12 plots, but I cannot get it to work. I've tried for example > > par(mfrow=c(3,4)) > > for(i in levels(fHCGB$code)) with(subset(fHCGB,code==i), > plot(pooledPlateIntra, type="b", ylim=ylim, xlab=code, ylab="CV%") > points(fHCGB$limitVarC,type="b", col="green"))) > > But run into errors. How can the lines be added? >The with() construct gets a little more complicated if you want to do more than one thing inside: for(i in levels(fHCGB$code)) with(subset(fHCGB,code==i), { plot(pooledPlateIntra, type="b", ylim=ylim, xlab=code, ylab="CV%") points(fHCGB$limitVarC,type="b", col="green") }) or, since with() is really only needed for the plot() for(i in levels(fHCGB$code)) { with(subset(fHCGB,code==i), plot(pooledPlateIntra, type="b", ylim=ylim, xlab=code, ylab="CV%")) points(fHCGB$limitVarC,type="b", col="green") } (& you might have used lines() rather than points() if you think of it as an added line, but that's a matter of taste since the two functions only differ in the default for type=.) -p> Taija Saanisto > Biostatistician > Quality assurance, Process Development > PerkinElmer Life and Analytical Sciences / Wallac Oy > Phone: +358-2-2678 741 > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Apparently Analagous Threads
- nouveau TRAP_M2MF still there on G98
- [Bug 2678] New: PubKey Authentication fails when more than one user/group ACL is set on any Path component to authorized_keys
- Error With Xeon 2678 in virt-manager
- Calls being dropped
- Missing Content-Length header breaks ActiveResource 3.1 on create