Description Usage Arguments Details Examples
flip_ggplot_build
is a supplementary function for ggplot_build.
Changes ggplot_build output in order to make it compatible with the
plot when coordinates are flipped.
1 | flip_ggplot_build(ggplot_build_data)
|
ggplot_build_data |
output of |
data
from the output of ggplot_build
has
names of columns compatible with the mapping. In case when coordinates are flipped,
it is not consistent with the displayed plot. flip_ggplot_build
changes
the names so that coordinates from the output of ggplot_build
are compatible with the plot and returns it. In case when coordinates are not flipped
flip_ggplot_build
returns ggplot_build_data
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
# returns plot info without any change because coordinates are not flipped
p <- ggplot(Orange, aes(x = age, y = circumference, col = Tree)) +
geom_point() +
geom_line()
plot_info <- ggplot_build(p)
flip_ggplot_build(plot_info) # it is the same as plot_info
# returns plot info with data modified for flipped coordinates
p <- ggplot(Orange, aes(x = age, y = circumference, col = Tree)) +
geom_point() +
geom_line() +
coord_flip()
plot_info <- ggplot_build(p)
flip_ggplot_build(plot_info)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.