Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change size of regression line in panel.abline in Lattice?

Ok, I've been looking for a function that helps me change the size of my regression line in xyplot. I tried panel.abline(reg = coef, size = 2) but it doesn't work.

Hear is my code,

Plot.col <- brewer.pal(8,"Set1")[8][cut(Std.Change, c(-2.5,2.5), label = FALSE)]
Plot.ord <- rev(order(Std.Change))

coef <- coef(lm(Std.ModernC ~ Std.Change, data = Std.DataReg))
xyplot(Std.ModernC ~ Std.Change, data = Std.DataReg[Plot.ord, ], type = c("p", "g"), col = "blue",pch = 21, fill = Plot.col[Plot.ord], cex = 1.3,panel = function(...) {
  panel.xyplot(...)
  panel.abline(reg = coef, col = "blue")})

In ggplot, it is very easy to change for the size of regression line, by just setting geom_abline(size = 2)

I'm still learning lattice, and I don't know if there's a function for that, or whatsoever.

Any help is much appreciated.

like image 437
Al-Ahmadgaid Asaad Avatar asked Mar 03 '12 01:03

Al-Ahmadgaid Asaad


1 Answers

try

panel.abline(reg = coef, lwd = 2)

(although lwd ("line width") is listed in the help page, in order to figure this out you would probably have to be familiar with base graphics, which this specification mimics)

like image 126
Ben Bolker Avatar answered Sep 24 '22 17:09

Ben Bolker