ggplot2 change axis labels
[This article was first published on Ecological Modelling... » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Today, I will try to change the labels of the x and y axis.
library(ggplot2) # producing some data data <- data.frame(x=1:10, y=rnorm(10)) # initiating a plot p <- ggplot(data, aes(x,y)) # plotting it with different labels for both x and y. p + geom_point(aes(size=y)) + scale_x_continuous("x axis") + scale_y_continuous("y axis") # changing the tick intervalls on the x-axis p + geom_point(aes(size=y)) + scale_x_continuous("x axis",breaks=c(1,5,10)) + scale_y_continuous("y axis")
To leave a comment for the author, please follow the link and comment on their blog: Ecological Modelling... » R.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.