add_axes | R Documentation |
Wrapper for a call to either axis
or text
, used to add axis labels
to an existing plot.
add_axes(
at,
labels = NULL,
side = 1,
tick = F,
line = NULL,
cex = 1.25,
degrees = NULL,
xpd = NA,
adj = NULL,
...
)
at |
The positions (x or y-axis) at which to add axis labels. |
labels |
Optional vector matching in length to
|
side |
The side of the plot at which to add axis labels, either...
|
tick |
Logical; if |
line |
The number of lines into the margin at which
the axis line will be drawn. If |
cex |
Size of the text. |
degrees |
Number of degrees to rotate text
(note results in a call to |
xpd |
A logical value or |
adj |
... |
... |
Additional parameters to be passed to
either |
# Create blank plot
blank_plot()
# Draw boundaries
hv_line(x = 0)
hv_line(y = 0)
# Add axes
add_axes(c(0, .5, 1), c("Start", "Middle", "End"))
add_axes(c(0, .5, 1), c("Bottom", "Middle", "Top"), side = 2)
add_axes(.5, "Title", side = 3, cex = 2)
# Create blank plot with custom margins
par(mar = rep(4, 4))
blank_plot()
# Draw boundaries
hv_line(x = 0:1)
hv_line(y = 0:1)
# Add rotated axes
add_axes(c(0, .5, 1), c("Start", "Middle", "End"),
degrees = 45
)
add_axes(c(0, .5, 1), c("Start", "Middle", "End"),
degrees = 45, side = 3
)
add_axes(c(0, .5, 1), c("Bottom", "Middle", "Top"),
degrees = 45, side = 2
)
add_axes(c(0, .5, 1), c("Bottom", "Middle", "Top"),
degrees = 45, side = 4
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.