Plot linear model for two variables with R2 & P printed and saved
Simple function to plot and name a linear model
lmplot( x, y, xname = "X variable", yname = "Y variable", pngtype = c("cairo-png", "quartz", "Xlib"), xlab = xname, ylab = yname, plotname = xname, r2line = TRUE, pointtext = FALSE, pointlabs = x, pointcol = "black", savedir = "", ... )
x
: Explanatory variable data.y
: Response variable data.xname
: Variable name for plot header.yname
: Variable name for plot header.pngtype
: Filetype for png files, alternatively try "quartz" on Mac.xlab
: X axis label, parsed from xname unless specified.ylab
: Y axis label, parsed from yname unless specified.plotname
: Filename for png, parsed from xname unless specified.r2line
: Plot rsquared trendline, default TRUE.pointtext
: Label each point? Default FALSE.pointlabs
: Point labels, defaults to resvar value.pointcol
: Points colour, default "black".savedir
: Save location, end with "/"....
: Allows controlling of text label params e.g. adj cex &.Invisibly saves png plot into savedir.
Errors and their origins:
Simon Dedman, simondedman@gmail.com
Useful links