Created
February 5, 2018 16:08
-
-
Save padpadpadpad/6b577408470381feaae6348889433187 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
d <- data.frame(x = rnorm(20), y = rnorm(20)) | |
d$row <- paste('C', row.names(d), sep = '_') | |
# random plot | |
ggplot(d, aes(row, y)) + | |
geom_point() | |
# order by y, highest first | |
ggplot(d, aes(forcats::fct_reorder(row, y, .desc = TRUE), y)) + | |
geom_point() | |
# order by y, lowest first | |
ggplot(d, aes(forcats::fct_reorder(row, y), y)) + | |
geom_point() | |
# order by x | |
ggplot(d, aes(forcats::fct_reorder(row, x), y)) + | |
geom_point() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey,can i have your permission to run your coding on my pc ?