Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change axis scaling step size in ggplot2

Tags:

r

i have an R script which generate a geom_tile plot exactly as i want.

but the problem is that the axis step size is so big e.g(4000 - 8000 - 12000 - ...)

i tried scale_x_continuous('Xaxis',limits = c(...)) and scale_x_continuous(breaks=1:10)

but it only make limits to the data.

what should i do to minimize this step size on the axis?

e.g (500 - 1000 - 1500 - 2000 - 2500 ....etc)

thankk you

like image 982
ifreak Avatar asked Mar 14 '12 15:03

ifreak


1 Answers

Since no one has posted an answer yet, only comments, here it is :)

scale_x_continuous(breaks = seq(0, 10000, 500))

Source: http://docs.ggplot2.org/current/scale_continuous.html

like image 80
David J. Avatar answered Oct 03 '22 16:10

David J.