Hi I got a barplot that has values between 0-150 and the y-axis shows the steps 0 50 100 and 150 but I would like to change it to 0 10 20 30... ...130 140 150 Dont really know the word in english so sry about it beeing abit confusing :) Thx for your help Joel -- View this message in context: r.789695.n4.nabble.com/change-y-axis-distance-tp2548363p2548363.html Sent from the R help mailing list archive at Nabble.com.
On Tue, 2010-09-21 at 03:55 -0700, Joel wrote:> Hi > > I got a barplot that has values between 0-150 and the y-axis shows the steps > 0 50 100 and 150 but I would like to change it to 0 10 20 30... ...130 140 > 150 > > Dont really know the word in english so sry about it beeing abit confusing > :) > > Thx for your help > JoelIf you want to draw the ticks at specific locations rather than the ones R chooses for you, turn off the axes in your plot call and then cook your own axis using the axis() function. Here's an example using dummy data: set.seed(123) mdat <- rpois(10, 10) names(mdat) <- LETTERS[1:10] barplot(mdat, axes = FALSE) ## label at 1, 2, 3 etc not 2, 4, 6, etc axis(side = 2, at = seq(1, max(mdat), by = 2)) For you specific axis call, try: axis(side = 2, at = seq(0, 150, by = 10)) HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] ucl.ac.uk/~ucfagls UK. WC1E 6BT. [w] freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
On 09/21/2010 08:55 PM, Joel wrote:> > Hi > > I got a barplot that has values between 0-150 and the y-axis shows the steps > 0 50 100 and 150 but I would like to change it to 0 10 20 30... ...130 140 > 150 >Hi Joel, This is a combination of the "pretty" calculation of axis tick intervals and the silent omission of labels that appear to be crowded. You can probably get the fifteen labels by adding: # set the axis labels to all horizontal text par(las=1) # add the yaxt argument to plot plot(...,yaxt="n",...) # display the axis axis(2,at=seq(0,150,by=10),labels=seq(0,150,by=10)) If some of the labels are missing, you might have to turn to staxlab in the plotrix package or a similar function. Jim
Thx for all your help! -- View this message in context: r.789695.n4.nabble.com/change-y-axis-distance-tp2548363p2548461.html Sent from the R help mailing list archive at Nabble.com.