Sie sind auf Seite 1von 1

R Base Graphics Cheatsheet

SET GRAPHICAL PARAMETERS ADD TEXT


the following can only be set with par()
location size
par () (magnification factor)
axis labels xlab =, ylab =
all elements cex =
multiple mfcol = c(nrow,ncol) plot margins oma = c(bottom, left, subtitle sub =
(outer) top, right) default: axis labels cex.lab =
plots mfrow = c(nrow,ncol) title main =
c(0, 0, 0, 0) lines subtitle cex.sub =
plot margins mar = c(bottom, left, style tick mark labels cex.axis =
top, right) default: query x & y title cex.main =
par (usr) font face font = 1 (plain)
c(5.1, 4.1, 4.1, 2.1) lines limits
2 (bold) 3 (italic)
position
CREATE A NEW PLOT 4 (bold italic) text direction las = 1 (horizontal)
font family family = serif
Bar charts barplot(height, ) Histograms hist(x, ) justification adj = 0 .5 1
sans mono
bar labels names.arg = breakpts breaks = (left, center, right)
border border =
fill color col = ADD TO AN EXISTING PLOT
Line charts plot(x, type = l )
horizontal horiz = TRUE blank|0 Add new plot [any plot function] Lines lines (x,)
line type lty = solid|1 (,add = TRUE) line style lty =
Box plots boxplot(x, ) dashed|2 ex. barplot(x, add = TRUE) line width lwd =
dotted|3
horizontal horizontal = TRUE line width lwd = color col =
Axes axis (side, )
box labels names = location side = 1 2 3 4 Points points (x,)
(bottom, left, top, right) symbol pch =
Dot plots dotchart(x, ) Scatterplots plot(x, )
pch = tick mark:
dot labels labels = symbol
labels labels =
REMOVE ADJUST location at =
remove tick = FALSE color col =
axis labels ann = FALSE allow plotting
rotate text las = 1 (horizontal) fill color bg = (pch: 21-25 only)
out of plot xpd = TRUE
axis, tickmarks, xaxt = n Axis labels mtext (text, ) Text text (x, y, text,)
region
and labels yaxt = n location side = 1 2 3 4 position pos = 1 2 3 4
(bottom, left, top, right) (rel. to x,y) (below, left, above, right)
aspect ratio asp =
(default=center)
plot box bty = n lines to skip line = (from plot
axis limits xlim =, ylim = region, default = 0)
Title title (main,)
position at = x or y-coord axis labels xlab =, ylab =
NOTE: Many of the parameters here axis lines to xaxs = i , (depending on side)
can be also be set in par(). See R yaxs = i (internal subtitle sub =
match
help for more options. axis limits axis calculation)
justification adj = 0 .5 1 title main =
(left, center, right)
Joyce Robbins, joycerobbins1@gmail.com

Das könnte Ihnen auch gefallen