[R] How to specify axis interval unit...

V Prasanth vprasanth at deltaintech.com
Thu Apr 2 12:58:20 CEST 2009


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:
> Dear Jim:
>
> Many thanks for your reply. I will check out that said package for sure.
> 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. I am looking for a graph which is given in
> figure 2. Likewise, is it possible in R...?
>   
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:
> Dear R Users:
> 
>  
> 
> Greetings!
> 
>  
> 
> Is there any way to specify the axis interval unit for barplots in R.? 
> Any help is deeply appreciated.

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
> 
>  
> 
> Thanks in advance!
> 
> Prasanth VP,
> Global Manager - Biometrics,
> Delta Technology & Management Services Pvt Ltd, Plot No: 13/2, Sector
> - I, Third Floor, HUDA Techno Enclave, Madhapur, Hyderabad - 500 033.
> Office    : +91-40-3028 0659 
> Mobile   : +91-9848 290025 
>  <http://www.deltaintech.com/> www.deltaintech.com
> 
>  
> 
>  <http://www.deltaintech.com/>
> **********************************************************************
> ******
> **************
> 
>  <http://www.deltaintech.com/> 'The information contained in this 
> email is confidential and may contain proprietary information. It is 
> meant solely for the intended recipient. Access to this email by anyone
else is unauthorized.
> If you are not the intended recipient, any disclosure, copying, 
> distribution or any action taken or omitted in reliance on this, is 
> prohibited and may be unlawful. No liability or responsibility is 
> accepted if information or data is, for whatever reason corrupted or does
not reach its intended recipient.
> No warranty is given that this email is free of viruses. The views 
> expressed in this email are, unless otherwise stated, those of the 
> author and not those of DELTA Technology and Management Services pvt ltd
or its management.
> DELTA Technology and Management Services pvt ltd reserves the right to 
> monitor intercept and block emails addressed to its users or take any 
> other action in accordance with its email use policy'
> 
>  <http://www.deltaintech.com/> Thank you in advance for your cooperation.
> 
>  <http://www.deltaintech.com/>
> **********************************************************************
> ******
> **************
> 
>  <http://www.deltaintech.com/> P Please don't print this e-mail unless 
> you really need to.
> 
>  
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list