coord_axes_inside {ggh4x} | R Documentation |
Cartesian coordinates with interior axes
Description
This coordinate system places the plot axes at interior positions. Other
than this, it behaves like coord_cartesian()
or
coord_fixed()
(the latter if the ratio
argument
is set).
Usage
coord_axes_inside(
xlim = NULL,
ylim = NULL,
xintercept = 0,
yintercept = 0,
labels_inside = FALSE,
ratio = NULL,
expand = TRUE,
default = FALSE,
clip = "on"
)
Arguments
xlim , ylim |
Limits for the x and y axes. |
xintercept , yintercept |
A |
labels_inside |
A |
ratio |
Either |
expand |
If |
default |
Is this the default coordinate system? If |
clip |
Should drawing be clipped to the extent of the plot panel? A
setting of |
Value
A CoordAxesInside
object, which can be added to a plot.
Examples
# A standard plot
p <- ggplot(mpg, aes(scale(displ), scale(hwy))) +
geom_point() +
theme(axis.line = element_line())
# By default, axis text is still placed outside the panel
p + coord_axes_inside()
# However, this can simply be changed
p + coord_axes_inside(labels_inside = TRUE)
# The place where the axes meet can be changed
p + coord_axes_inside(xintercept = 1, yintercept = -1)
# Axes snap to the nearest limit when out-of-bounds
p + coord_axes_inside(xintercept = -5, yintercept = Inf, clip = "off")
# Can be combined with other non-default axes
p + guides(x = "axis_minor") +
coord_axes_inside()