add_axes.Rd
add_axes(
at,
labels = NULL,
side = 1,
tick = F,
line = NULL,
cex = 1.25,
degrees = NULL,
xpd = NA,
adj = NULL,
...
)
The positions (x or y-axis) at which to add axis labels.
Optional vector matching in length to
at
with user-defined labels.
The side of the plot at which to add axis labels, either...
1 = bottom;
2 = left;
3 = top;
4 = right.
Logical; if TRUE
draws tick marks
at the specified positions.
The number of lines into the margin at which
the axis line will be drawn. If degrees
does not
equal NULL
, must be specified relative
current plotting region (use par()$usr
to get x and y-axis coordinates for plot region).
Size of the text.
Number of degrees to rotate text
(note results in a call to text()
rather than axis()
).
A logical value or NA
. If FALSE
,
all plotting is clipped to the plot region. If TRUE
,
all plotting is clipped to the figure region, and if
NA
, all plotting is clipped to the device region.
...
Additional parameters to be passed to
either axis
or
text
(if a value is
provided for degrees
).
# 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
)