Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aurielfournier/1a2b32b4682eac4828d498bef2d11e08 to your computer and use it in GitHub Desktop.
Save aurielfournier/1a2b32b4682eac4828d498bef2d11e08 to your computer and use it in GitHub Desktop.
dat <- data.frame(x=c("C-1","C-2","C-10"),
y=c(1,2,3))
# in the wrong order
ggplot(data=dat, aes(x=x, y=y))+
geom_point()
dat$x <- factor(dat$x, levels=dat$x)
# in the right order
ggplot(data=dat, aes(x=x, y=y))+
geom_point()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment