[R] How to add multiple ablines

jim holtman jholtman at gmail.com
Sat Nov 27 07:07:41 CET 2010


just add more 'abline' calls, or pass multiple values; e.g.,

abline(v=c(1,2,3,4), h=c(10,20))


On Fri, Nov 26, 2010 at 9:41 PM, Stephen Liu <satimis at yahoo.com> wrote:
> Hi folks
>
> Run;
>> ToothGrowth
>> attach(ToothGrowth)
>> toothgrowth=lm(len~dose)
>
> adding abline:
>> abline(toothgrowth)
>
> I got it done adding single abline.
>
>
> How to add more ablines on the same diagram?
>
> I found following thread, applying "mapply" command;
>
> Plotting multiple ablines
> http://www.mail-archive.com/r-help@r-project.org/msg51543.html
>
> mapply(abline,
>    (converge$kY + tan((90-converge$kT) * pi / 180)*(-converge$kX)),
>    tan((90-converge$kT) * pi / 180))
>
> But couldn't resolve it.  Substituting "converge" with toothgrowth" didn't work?
> I also look at ?mapply.  Pls help.
>
> I don't have parameter of other ablines to be added.  This is only a learning
> example.  Any data can fit to them.
>
> TIA
>
> B.R.
> Stephen L
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list