pbreheny / visreg

Visualization of regression functions
http://pbreheny.github.io/visreg/
61 stars 18 forks source link

Change the transparency of the confidence band #43

Closed ManuelSpinola closed 6 years ago

ManuelSpinola commented 6 years ago

Is it possible to change the transparency of the confidence band in visreg?

pbreheny commented 6 years ago

Well, the way it's set up in base R is that transparency is a property of the color, so by changing the color, you can change the transparency:

fit <- lm(Ozone ~ Solar.R + Wind*Temp, data=airquality)
visreg(fit, "Wind", fill.par=list(col=grey(0.5, 0.05)))  # Really transparent
visreg(fit, "Wind", fill.par=list(col=grey(0.5, 0.95)))  # Nearly opaque

Does that help?

visreg doesn't currently support this, but I suppose it might be possible to allow something like fill.par=list(alpha=0.3), so that you could change the transparency directly and leave the shade/tint unaffected.

ManuelSpinola commented 6 years ago

Thank you very much Patrick. I have been using and teaching visreg. Is a great package and very necessary to plot the results from models.

Manuel

2018-03-12 13:53 GMT-06:00 Patrick Breheny notifications@github.com:

Well, the way it's set up in base R is that transparency is a property of the color, so by changing the color, you can change the transparency:

fit <- lm(Ozone ~ Solar.R + Wind*Temp, data=airquality) visreg(fit, "Wind", fill.par=list(col=grey(0.5, 0.05))) # Really transparent visreg(fit, "Wind", fill.par=list(col=grey(0.5, 0.95))) # Nearly opaque

Does that help?

visreg doesn't currently support this, but I suppose it might be possible to allow something like fill.par=list(alpha=0.3), so that you could change the transparency directly and leave the shade/tint unaffected.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pbreheny/visreg/issues/43#issuecomment-372441441, or mute the thread https://github.com/notifications/unsubscribe-auth/AVGyh97jhECBFanw3DcE8nHyEvVGYd9wks5tdtJCgaJpZM4SmzjR .

-- Manuel Spínola, Ph.D. Instituto Internacional en Conservación y Manejo de Vida Silvestre Universidad Nacional Apartado 1350-3000 Heredia COSTA RICA mspinola@una.cr mspinola@una.ac.cr mspinola10@gmail.com Teléfono: (506) 8706 - 4662 Personal website: Lobito de río https://sites.google.com/site/lobitoderio/ Institutional website: ICOMVIS http://www.icomvis.una.ac.cr/

pbreheny commented 6 years ago

Thanks, Manuel!