Graphs in R How different: • Once drawn, you cannot erase • Draw elements one by one • You have a lot of control over the presentation The difficult part (in my opinion) • par() • dimension • letter size balance • margin balance The tricky part • dev.off() - just because we forget • Close the pdf before redoing the figure • Or use light-weight pdf viewers • pch - point characters Graphic parameters - par() • Contains information on graphing "details" • overall letter size • axes letter size • label letter size • line thickness • font, font size • margins (bottom, left, top, right) • how many figures on a page (e.g., 2 by 3) • and more! plot.default() • Another important default values when plotting • frame the graph or not • number limits • draw axes or not • line types (dotted, dashed, solid, etc.) Most of these you don't need to touch If you want to change > par(mfrow=c(2,4), mar=c(4,3,3,1)) !!!REMEMBER what the value was before!!! You don't need to change plot.default() Instead, specify in your plots plot() • Most "from-scratch" kind of plotting command • Other plotting commands are available (not covered here today) - Please ask Google • What it does: • Creates axes, labels, frame, and title, where applicable • If specified, draw lines or points (data) as well • Most useful when your graph is simple • Still useful for complex graphs • You can choose not to draw data with this command, yet specify a good x-axis range and a good y-axis range Data drawing • points() • lines() • These draw actual data alone • Requires the base plot (frame, or "field of drawing") already in place Graph output file • pdf() • png() • etc. • type ?Devices to see the available format for your OS and R version • the way to specify the size of output file differs among the commands; check the help files