View source: R/coord_axes_inside.R
coord_axes_inside | R Documentation |
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).
coord_axes_inside(
xlim = NULL,
ylim = NULL,
xintercept = 0,
yintercept = 0,
labels_inside = FALSE,
ratio = NULL,
expand = TRUE,
default = FALSE,
clip = "on"
)
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 |
A CoordAxesInside
object, which can be added to a plot.
# 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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.