View source: R/plot_regression.R
plot_regression | R Documentation |
Draw regression curve with smoothed error bars with Visually-Weighted Regression by Solomon M. Hsiang; see http://www.fight-entropy.com/2012/07/visually-weighted-regression.html The R is modified from Felix Schonbrodt's original code http://www.nicebread.de/ visually-weighted-watercolor-plots-new-variants-please-vote
plot_regression(
formula,
data,
B = 1000,
shade = TRUE,
shade.alpha = 0.1,
spag = FALSE,
mweight = TRUE,
show.lm = FALSE,
show.median = TRUE,
median.col = "white",
show.CI = FALSE,
method = loess,
slices = 200,
ylim = NULL,
quantize = "continuous",
show.points = TRUE,
color = NULL,
pointsize = NULL,
...
)
formula |
formula |
data |
data |
B |
number bootstrapped smoothers |
shade |
plot the shaded confidence region? |
shade.alpha |
shade.alpha: should the CI shading fade out at the edges? (by reducing alpha; 0=no alpha decrease, 0.1=medium alpha decrease, 0.5=strong alpha decrease) |
spag |
plot spaghetti lines? |
mweight |
visually weight the median smoother |
show.lm |
plot the linear regression line |
show.median |
show median smoother |
median.col |
median color |
show.CI |
should the 95% CI limits be plotted? |
method |
the fitting function for the spaghettis; default: loess |
slices |
number of slices in x and y direction for the shaded region. Higher numbers make a smoother plot, but takes longer to draw. I wouldn't go beyond 500 |
ylim |
restrict range of the watercoloring |
quantize |
either 'continuous', or 'SD'. In the latter case, we get three color regions for 1, 2, and 3 SD (an idea of John Mashey) |
show.points |
Show points. |
color |
Point colors |
pointsize |
Point sizes |
... |
further parameters passed to the fitting function, in the case of loess, for example, 'span=.9', or 'family='symmetric” |
ggplot2 object
Based on the original version from F. Schonbrodt. Modified by Leo Lahti microbiome-admin@googlegroups.com
See citation('microbiome')
data(atlas1006)
pseq <- subset_samples(atlas1006,
DNA_extraction_method == 'r' &
sex == "female" &
nationality == "UKIE",
B=10, slices=10 # non-default used here to speed up examples
)
p <- plot_regression(diversity ~ age, meta(pseq)[1:20,], slices=10, B=10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.