Description Usage Arguments Value Author(s) See Also Examples
Generate an empty plot window.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
xlim |
A one- or two-value vector indicating the range of the x-axis.
If |
ylim |
A one- or two-value vector indicating the range of the y-axis.
(See |
main |
Title for the plot. Empty by default.
Note: the title can be added later using |
xlab |
Label for x-axis. Empty by default. If no label is provided,
use |
ylab |
Label for y-axis. Empty by default. (See |
h0 |
A vector indicating where to add solid horizontal lines for reference. By default no values provided. |
v0 |
A vector indicating where to add dotted vertical lines for reference. By default no values provided. |
bty |
A character string which determined the type of box which is drawn about plots. If bty is one of 'o', 'l', '7', 'c', 'u', or ']' the resulting box resembles the corresponding upper case letter. A value of 'n' (the default) suppresses the box. |
eegAxis |
Logical: whether or not to reverse the y-axis, plotting the negative amplitudes upwards as traditionally is done in EEG research. If eeg.axes is TRUE, labels for x- and y-axis are provided, when not provided by the user. Default value is FALSE. |
xmark |
Numeric factor with x-axis tick marks and limits.
If NULL (default) R's default system is used. If TRUE, only the |
ymark |
Numeric factor with y-axis tick marks and limits.
If NULL (default) R's default system is used. If TRUE, only the |
... |
Other arguments for plotting, see |
An empty plot window.
Jacolien van Rij
Use title
and
mtext
for drawing labels and titles;
use lines
and points
for plotting the data;
use legend
or
legend_margin
for adding a legend.
Other Functions for plotting:
addInterval()
,
add_bars()
,
add_n_points()
,
alphaPalette()
,
alpha()
,
check_normaldist()
,
color_contour()
,
dotplot_error()
,
drawDevArrows()
,
errorBars()
,
fill_area()
,
getCoords()
,
getFigCoords()
,
getProps()
,
gradientLegend()
,
legend_margin()
,
marginDensityPlot()
,
plot_error()
,
plot_image()
,
plotsurface()
,
sortBoxplot()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # generate some measurements:
x <- runif(100,0,100)
y <- rpois(100,lambda=3)
# Setup empty plot window fitting for data:
emptyPlot(range(x), range(y))
# To add data, use lines() and points()
points(x,y, pch=16, col=alpha('steelblue'))
# Category labels:
emptyPlot(toupper(letters[1:5]), 1)
# order matters:
emptyPlot(sample(toupper(letters[1:5])), 1)
# actually, they are plotted on x-positions 1:5
points(1:5, rnorm(5, mean=.5, sd=.1))
# also possible for y-axis or both:
emptyPlot(c(200,700), toupper(letters[1:5]))
emptyPlot(as.character(8:3), toupper(letters[1:5]))
# change orientation of labels:
par(las=1)
emptyPlot(c(200,700), toupper(letters[1:5]))
par(las=0) # set back to default
# More options:
emptyPlot(range(x), range(y),
main='Data', ylab='Y', xlab='Time')
# add averages:
m <- tapply(y, list(round(x/10)*10), mean)
lines(as.numeric(names(m)), m, type='o', pch=4)
# with vertical and horizontal lines:
emptyPlot(1, 1, h0=.5, v0=.75)
# eeg axis (note the axes labels):
emptyPlot(c(-200,1000), c(-5,5),
main='EEG', v0=0, h0=0,
eegAxis=TRUE)
# simplify axes:
emptyPlot(c(-3.2,1.1), c(53,58),
xmark=TRUE, ymark=TRUE, las=1)
# compare with R default:
emptyPlot(c(-3.2,1.1), c(53,58), las=1)
# also possible to specify values manually:
emptyPlot(c(-3.2,1.1), c(53,58),
xmark=c(-3.2,0, 1.1), ymark=c(55,57), las=1)
# empty window:
emptyPlot(1,1,axes=FALSE)
# add box:
emptyPlot(1,1, bty='o')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.