Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Graphics
R.M. Ripley
Department of Statistics
University of Oxford
2012/13
Graphics
Can save or print plot from the graphics window menu (not
Unix), or open special device such as pdf, run the plot and
then close the device using dev.off(). e.g.
pdf("myfile.pdf")
plot(1:10)
dev.off()
Base Graphics
Plot types
The type argument controls how the points or lines are drawn.
The main options are:
type="p" plots points
type="l" plots a line (the data must be in the correct order!)
type="n" plots nothing,just creates the axes for later use
type="b" plots both lines and points, lines miss the points
type="o" plot overlaid lines and points
type="h" plots histogram-like vertical lines
type="s" plots step-like lines
Terminate early by
clicking the middle mouse button (if present (or wheel!))
right-clicking and selecting Stop
selecting Stop from the graphics menu.
Mathematics in labels
Lattice Graphics
Lattice Graphics
Panel functions
Conditioning plots
Can create a set of panels in one plot, with each panel
corresponding to a subset of the data defined by conditioning
variables.
specify the conditioning variables in the formula after a |,
separated by *
The panel function is called once for each panel, with
appropriate points, and an argument subscripts, indices of
the points in the input data.
Conditioning numeric variables will be converted to shingles
(overlapping factors), but default is to use all the unique
values. Use equal.count(x) for fewer groups. e.g.
Cath <- equal.count(swiss$Catholic)
xyplot(Fertility ~ Education | Cath,
data=swiss)
Examples in demo 4.7
R.M. Ripley (University of Oxford) R 2012/13 18 / 28
Graphics Lattice Graphics
Exercises 4 Page 1
Exercises 4 Page 2