blankplot | R Documentation |
Draws a blank plotting area for further handmade drawings.
blankplot(
xlim = c(0, 1),
ylim = c(0, 1),
bty = "l",
mgp = c(2.5, 1, 0),
main = "",
sub = "",
xlab = "",
ylab = "",
...
)
xlim |
A pair of numerics. The x limits of the plot. |
ylim |
A pair of numerics. The y limits of the plot. |
bty |
A character. The type of box of the plot
passed to |
mgp |
A set of three numerics. The amounts of margin lines
passed to |
main |
A string. The main title (by default a blank). |
sub |
A string. The sub title (by default a blank). |
xlab |
A string. The label for the x axis (by default a blank). |
ylab |
A string. The label for the y axis (by default a blank). |
... |
Other arguments passed to |
R's built-in plotting functions such as
graphics::plot()
, graphics::boxplot()
and graphics::hist()
are
so useful that your daily analysis and data visualization can be
often completed by only these function.
However, there are also times that you want to create
more complicated graphs.
In such cases, you will first construct a blank plotting are
by graphics::plot()
, and then further add required drawings.
blankplot()
can be used as a quick wrapper for this routine procedure.
Just use it to create a tabula-rasa plotting region
with designated x and y limits,
from where your data visualization can start over.
n <- 100
r <- seq(0, 2 * pi, length.out = n)
x <- 16 * sin(r)^3
y <- 13 * cos(r) - 5 * cos(2 * r) -
2 * cos(3 * r) - cos(4 * r)
blankplot(range(x), range(y))
col <- rainbow(n)
segments(x, y, x[1], y[1], col = col, lty = "22")
segments(x[-n], y[-n], x[-1], y[-1], col = col[-1])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.