Hmisc xYplot: two ablines?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Hmisc xYplot: two ablines?

Michael Kubovy
Dear r-helpers,

Happy New Year.

To a plot

xYplot(lo ~ vaR, groups = v, data = abc1.fp,aspect = "xy",
        xlab=expression(frac(abs( bold(v) ),abs( bold(a) ))),
        ylab = grid::textGrob(expression(paste(log, frac( italic(p) ( italic
(v) ), italic(p) ( italic(a) )))) ),
        abline =list(a = 5.71442, b = -5.71442, col = 2)
)

I would like to add another abline such as abline = list(a = 8.8460,  
b = -8.8460, col = 3). Any advice?


_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
         McCormick Road    Charlottesville, VA 22903
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
WWW:    http://www.people.virginia.edu/~mk9y/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Hmisc xYplot: two ablines?

Michael Kubovy
To r-help:

Thanks to Mat Soukup for the help:

To draw two ablines:

xYplot(lo ~ vaR, groups = v, data = abc.fp, aspect = "xy", col = c
("red","blue"),
        xlab=expression(frac(abs( bold(v) ),abs( bold(a) ))),
        ylab = grid::textGrob(expression(paste(log, frac( italic(p) ( italic
(v) ), italic(p) ( italic(a) )))) ),
        panel=function(x,y,...){
                panel.xYplot(x, y, ...)
                panel.abline(a = 7.985090, b= -7.985090, col = "red")
                panel.abline(a = 7.926507, b = -7.926507, col = "blue", lty = 2)
        }
)

This is (to me) a surprising syntactic leap from one abline in  
xYplot, which can be requested without writing a panel function:

xYplot(lo ~ vaR, groups = v, data = abc.fp, aspect = "xy", col = c
("red","blue"),
        xlab=expression(frac(abs( bold(v) ),abs( bold(a) ))),
        ylab = grid::textGrob(expression(paste(log, frac( italic(p) ( italic
(v) ), italic(p) ( italic(a) )))) ),
        panel.abline(a = 7.985090, b= -7.985090, col = "red")
)

_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
         McCormick Road    Charlottesville, VA 22903
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
WWW:    http://www.people.virginia.edu/~mk9y/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html