coord_trans_flip
behaves similarly to ggplot2::coord_trans()
in that it
occurs after statistical transformation and will affect the visual appearance
of geoms. The main difference is that it also flips the x and y coordinates
like ggplot2::coord_flip()
.
coord_trans_flip(
x = "identity",
y = "identity",
xlim = NULL,
ylim = NULL,
clip = "on",
expand = TRUE
)
Transformers for x and y axes or their names.
Limits for the x and y axes.
Should drawing be clipped to the extent of the plot panel? A
setting of "on"
(the default) means yes, and a setting of "off"
means no. In most cases, the default of "on"
should not be changed,
as setting clip = "off"
can cause unexpected results. It allows
drawing of data points anywhere on the plot, including in the plot margins. If
limits are set via xlim
and ylim
and some data points fall outside those
limits, then those data points may show up in places such as the axes, the
legend, the plot title, or the plot margins.
If TRUE
, the default, adds a small expansion factor to
the limits to ensure that data and axes don't overlap. If FALSE
,
limits are taken exactly from the data or xlim
/ylim
.
Giving a logical vector will separately control the expansion for the four
directions (top, left, bottom and right). The expand
argument will be
recycled to length 4 if necessary. Alternatively, can be a named logical
vector to control a single direction, e.g. expand = c(bottom = FALSE)
.
library(ggplot2)
ggplot(mtcars, aes(disp, wt)) +
geom_point() +
coord_trans_flip(x = "log10", y = "log10")
Run the code above in your browser using DataLab