Skip to content

How to specify axis interval unit...

1 message · V Prasanth

#
Dear R Users:

Greetings!

Finally, I got what I required...! Thanks a lot for all of your valuable
support, especially to Jim and Duncan Murdoch. Great help guys...
By the way, herewith I am furnishing the code that I used for adjusting the
axis interval unit... Hope it will be useful to others, at least the
beginners in R!


T <- c(46, 61, 64, 75, 99, 103, 71, 101, 118, 134, 114, 111, 142, 115, 125,
103, 152, 120, 123,  87, 169, 215)

Year <- c(1988:2009)

bp <- barplot(T, col="orange", las=1, main="Burley tobacco production over
the years", xaxt="n",
	xlab=list("Year", font=2), ylab=list("million kg", font=2))

customlabels <- seq(1988, 2009, by=2)
n <- length(customlabels)
j <- 1
New_at <- 1:n
for(i in 1:n)
	{
	New_at[i] <- bp[j]
	j <- j+2
	}
axis(1, at=New_at, labels=customlabels)


Cheerio!
Prasanth.


-----Original Message-----
From: Jim Lemon [mailto:jim at bitwrit.com.au] 
Sent: Wednesday, April 01, 2009 4:07 PM
To: V Prasanth
Subject: Re: [R] How to specify axis interval unit...
V Prasanth wrote:
Hi Prasanth,
I think if you try this:

plot(...,xaxt="n")
customlabels<-seq(1990,2008,by=2)
axis(1,at=customlabels,labels=customlabels)

you'll get what you want.

Jim

-----Original Message-----
From: V Prasanth [mailto:vprasanth at deltaintech.com] 
Sent: Wednesday, April 01, 2009 10:53 AM
To: 'r-help at r-project.org'
Subject: FW: [R] How to specify axis interval unit...

Dear Duncan Murdoch:

Thanks for your tips. By the way, I think I didn't mentioned my question
very clear. What I mean to say is that, in Excel one could decide upon the
axis interval unit. Please see the attached file. Likewise, is it possible
in R...?

Regards,
Prasanth.

-----Original Message-----
From: Duncan Murdoch [mailto:murdoch at stats.uwo.ca]
Sent: Tuesday, March 31, 2009 6:25 PM
To: V Prasanth
Cc: r-help at r-project.org
Subject: Re: [R] How to specify axis interval unit...
On 3/31/2009 5:08 AM, V Prasanth wrote:
You can set axes=FALSE, names="" and then use whatever axes you like. 
Modifying the first example in examples(barplot):

tN <- table(Ni <- stats::rpois(100, lambda=5)) r <- barplot(tN,
col=rainbow(20), axes=F, names="") axis(2, at=2^(0:5)) axis(1, at=r,
labels=letters[1:length(tN)])

Duncan Murdoch
else is unauthorized.
not reach its intended recipient.
or its management.