[R] Help barplots
jim at bitwrit.com.au
Tue Jun 1 14:02:39 CEST 2010
On 06/01/2010 09:01 PM, khush ........ wrote:
> Dear All,
> I am newbie to R, and I wanted to plot a barplots with R and in such a way
> that It will also show me position which I can plot on the bar line.
> Here is my code that I am using to plot,
>> chromosome<- c(40.2, 35.6, 36.1, 29.6, 31, 29.6, 31, 29.4, 28.2, 23, 23,
>> barplot (chromosome, col="purple", xlab="Oryza sativa Chromosomes", border
> = NA, space = 5, ylim = c(0,45))
> I wanted to mark the position say on chromosome 1 (40.2) I need to mark 10.2
> and on other also.
> I also want to set the scale of y axis from 0,5,10,15,20,25,30,35,40,45 i.e
> gap of 5 instead of 10.
> please help me to solve my query....gurus.
I think you want the x positions of the bars. Get them like this:
xpos<-barplot (chromosome, col="purple",
xlab="Oryza sativa Chromosomes",
border = NA, space = 5, ylim = c(0,45))
Then you can place the extra labels using the values in xpos.
For the custom y axis, add the argument yaxt="n" to your plot command
and then add the axis later. I suspect you will have to use something
like the staxlab function in the plotrix package to get all those labels
More information about the R-help