Reputation: 49
I am using the diamonds data set to do some analysis for a project. I need to figure out how to change the x and y scales. When I use this:
library(ggplot2)
ggplot(diamonds, aes(x=carat,y=price))+geom_point()+ylab("Diamond Price")+
xlab("Diamond Cut")
the x scale is 0-5 and the y scale is 1000-5000. How can I change the scale and intervals?
Thanks in advance
Upvotes: 1
Views: 1022
Reputation: 3280
Use xlim
or ylim
:
ggplot(diamonds, aes(x=carat,y=price)) +
geom_point() + ylab("Diamond Price") + xlab("Diamond Cut") +
ylim(0, 5000) + xlim(0,2)
Upvotes: 1