[R] plot: abline() - define line length *solved*

Jörg Groß joerg at licht-malerei.de
Thu Jan 22 01:39:12 CET 2009



Thanks, that's great!



Am 22.01.2009 um 01:18 schrieb Remko Duursma:

> I use this function (a lot):
>
> ablinepiece <- function(a=NULL,b=NULL,reg=NULL,from,to,...){
>
>    # Borrowed from abline
>    if (!is.null(reg)) a <- reg
>
>    if (!is.null(a) && is.list(a)) {
>            temp <- as.vector(coefficients(a))
>
>        if (length(temp) == 1) {
>            a <- 0
>            b <- temp
>        }
>        else {
>            a <- temp[1]
>            b <- temp[2]
>        }
>    }
>
>    segments(x0=from,x1=to,
>             y0=a+from*b,y1=a+to*b,...)
>
> }
>
>
>
> -------------------------------------------------
> Remko Duursma
> Post-Doctoral Fellow
>
> Centre for Plant and Food Science
> University of Western Sydney
> Hawkesbury Campus
> Richmond NSW 2753
>
> Dept of Biological Science
> Macquarie University
> North Ryde NSW 2109
> Australia
>
> Mobile: +61 (0)422 096908
>
>
>
> On Thu, Jan 22, 2009 at 11:01 AM, Jörg Groß <joerg at licht-malerei.de>  
> wrote:
>> Hi,
>>
>> is there a way to define, that a line drawn via abline() should  
>> only go from
>> for example -2 to 1 on the x-axis (with something working similiar to
>> xlim()) ?
>>
>> thanks for any help!
>>
>> ______________________________________________
>> 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.
>>




More information about the R-help mailing list