Plotting Flashcards
plot(x)
plot of the values of x (on the y-axis) ordered on the x-axis
plot(x, y)
bivariate plot of x (on the x-axis) and y (on the y-axis)
hist(x)
histogram of the frequencies of x
barplot(x)
histogram of the values of x; use horiz=FALSE for horizontal
bars
dotchart(x)
if x is a data frame, plots a Cleveland dot plot (stacked plots
line-by-line and column-by-column)
pie(x)
circular pie-chart
boxplot(x)
“box-and-whiskers” plot
sunflowerplot(x, y)
id. than plot() but the points with similar coor-
dinates are drawn as flowers which petal number represents the num-
ber of points
stripplot(x)
plot of the values of x on a line (an alternative to
boxplot() for small sample sizes)
coplot(x ̃y | z)
bivariate plot of x and y for each value or interval of
values of z
interaction.plot (f1, f2, y)
if f1 and f2 are factors, plots the
means of y (on the y-axis) with respect to the values of f1 (on the x-axis) and of f2 (different curves); the option fun allows to choose the summary statistic of y (by default fun=mean)
matplot(x,y)
bivariate plot of the first column of x vs. the first one of y, the second one of x vs. the second one of y, etc.
fourfoldplot(x)
visualizes, with quarters of circles, the association be- tween two dichotomous variables for different populations (x must be an array with dim=c(2, 2, k), or a matrix with dim=c(2, 2) if k = 1)
assocplot(x)
Cohen–Friendly graph showing the deviations from inde- pendence of rows and columns in a two dimensional contingency ta- ble
mosaicplot(x)
‘mosaic’ graph of the residuals from a log-linear regres- sion of a contingency table
pairs(x)
if x is a matrix or a data frame, draws all possible bivariate plots between the columns of x
plot.ts(x)
if x is an object of class “ts”, plot of x with respect to time, x may be multivariate but the series must have the same frequency and dates
ts.plot(x)
id. but if x is multivariate the series may have different dates and must have the same frequency
qqnorm(x)
quantiles of x with respect to the values expected under a nor- mal law
qqplot(x, y)
quantiles of y with respect to the quantiles of x
contour(x, y, z)
contour plot (data are interpolated to draw the curves), x and y must be vectors and z must be a matrix so that dim(z)=c(length(x), length(y)) (x and y may be omitted)
filled.contour(x, y, z)
id. but the areas between the contours are
coloured, and a legend of the colours is drawn as well
image(x, y, z)
id. but with colours (actual data are plotted)
persp(x, y, z)
id. but in perspective (actual data are plotted)
stars(x)
if x is a matrix or a data frame, draws a graph with segments or a
star where each row of x is represented by a star and the columns are
the lengths of the segments
symbols(x, y, …)
draws, at the coordinates given by x and y, sym-
bols (circles, squares, rectangles, stars, thermometres or “boxplots”)
which sizes, colours . . . are specified by supplementary arguments
termplot(mod.obj)
plot of the (partial) effects of a regression model
mod.obj
add=FALSE
if TRUE superposes the plot on the previous one (if it exists)
axes=TRUE
if FALSE does not draw the axes and the box
type=”p”
specifies the type of plot, “p”: points, “l”: lines, “b”: points
connected by lines, “o”: id. but the lines are over the points, “h”: vertical lines, “s”: steps, the data are represented by the top of the vertical lines, “S”: id. but the data are represented by the bottom of the vertical lines
xlim=, ylim=
specifies the lower and upper limits of the axes, for exam- ple with xlim=c(1, 10) or xlim=range(x)
xlab=, ylab=
annotates the axes, must be variables of mode character
main=
main title, must be a variable of mode character
sub=
sub-title (written in a smaller font)