Al-Ahmadgaid Asaad
Al-Ahmadgaid Asaad

Reputation: 1182

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.

Upvotes: 5

Views: 14574

Answers (1)

Ben Bolker
Ben Bolker

Reputation: 226232

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)

Upvotes: 12

Related Questions