[R] barplot() options for intervals on axes

2004-12-06 Thread Sebastien Moretti
Hello,
I am a beginner with R. I read many tutorials and the FAQ but I cannot solve 
my problem. 
I use barplot() to view my graph. I try to get more interval marks on y axis.
I wasn't able to find options in 'help(barplot)' or 'help(par)' to do this 
with barplot().

I seek for another option to print y values on my bars like on the graph of 
the R homepage: http://www.r-project.org/

Thanks for your help.

-- 
Sebastien MORETTI
Linux User - #327894
CNRS - IGS
31 chemin Joseph Aiguier
13402 Marseille cedex 20, FRANCE
tel. +33 (0)4 91 16 44 55

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] barplot() options for intervals on axes

2004-12-06 Thread Uwe Ligges
Sebastien Moretti wrote:
Hello,
I am a beginner with R. I read many tutorials and the FAQ but I cannot solve 
my problem. 
I use barplot() to view my graph. I try to get more interval marks on y axis.
I wasn't able to find options in 'help(barplot)' or 'help(par)' to do this 
with barplot().
See ?par and ?axis.
You might want to omit the y-axis completely at first (argument 
yaxt=n) and add one manually useing axis(2, ).


I seek for another option to print y values on my bars like on the graph of 
the R homepage: http://www.r-project.org/
Click on the image and see the code how it was generated.
Uwe Ligges
Thanks for your help.
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] barplot() options for intervals on axes

2004-12-06 Thread Chuck Cleland
  Did you see the lab argument to par()?
'lab' A numerical vector of the form 'c(x, y, len)' which modifies
  the way that axes are annotated.  The values of 'x' and 'y'
  give the (approximate) number of tickmarks on the x and y
  axes and 'len' specifies the label size.  The default is
  'c(5, 5, 7)'. _Currently_, 'len' _is unimplemented_.
  You might want something like this:
par(lab=c(5,10,7))
barplot(runif(10))
Sebastien Moretti wrote:
Hello,
I am a beginner with R. I read many tutorials and the FAQ but I cannot solve 
my problem. 
I use barplot() to view my graph. I try to get more interval marks on y axis.
I wasn't able to find options in 'help(barplot)' or 'help(par)' to do this 
with barplot().

I seek for another option to print y values on my bars like on the graph of 
the R homepage: http://www.r-project.org/

Thanks for your help.
--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] barplot() options for intervals on axes

2004-12-06 Thread Sebastien Moretti
Did you see the lab argument to par()?

 'lab' A numerical vector of the form 'c(x, y, len)' which modifies
the way that axes are annotated.  The values of 'x' and 'y'
give the (approximate) number of tickmarks on the x and y
axes and 'len' specifies the label size.  The default is
'c(5, 5, 7)'. _Currently_, 'len' _is unimplemented_.

You might want something like this:

 par(lab=c(5,10,7))
 barplot(runif(10))


'lab' doesn't change my graph. It is always the same.
Maybe it doesn't work with other options I use in barplot:

barplot(y,xlab=Number of splice variants,ylab=Number of 
genes,col=red1,names.arg=x,border=red1,axes=TRUE,ylim=c(0,max(y)))



  Hello,
  I am a beginner with R. I read many tutorials and the FAQ but I cannot
  solve my problem.
  I use barplot() to view my graph. I try to get more interval marks on y
  axis. I wasn't able to find options in 'help(barplot)' or 'help(par)' to
  do this with barplot().
 
  I seek for another option to print y values on my bars like on the graph
  of the R homepage: http://www.r-project.org/
 
  Thanks for your help.

-- 
Sebastien MORETTI
Linux User - #327894
CNRS - IGS
31 chemin Joseph Aiguier
13402 Marseille cedex 20, FRANCE
tel. +33 (0)4 91 16 44 55

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] barplot() options for intervals on axes

2004-12-06 Thread Marc Schwartz
On Mon, 2004-12-06 at 15:30 +0100, Sebastien Moretti wrote:
 Hello,
 I am a beginner with R. I read many tutorials and the FAQ but I cannot solve 
 my problem. 
 I use barplot() to view my graph. I try to get more interval marks on y axis.
 I wasn't able to find options in 'help(barplot)' or 'help(par)' to do this 
 with barplot().
 
 I seek for another option to print y values on my bars like on the graph of 
 the R homepage: http://www.r-project.org/
 
 Thanks for your help.

The general process of customizing the annotation of the axes for a
variety of plots is posted frequently to this e-mail list, so a search
of the archive using axis as the keyword yields almost 2,000 hits.
Using axis labels narrows that to 650, which are more relevant.

The key is to inhibit the generation of the default y axis by using the
argument 'yaxt = n':

Compare:

barplot(1:5)

versus

barplot(1:5, yaxt = n)


You can then use the axis() function to customize the y axis values:

barplot(1:5, yaxt = n)
axis(2, at = seq(0, 5, 0.25), las = 1)

help(par) provides additional information on the graphic parameters,
which are the key to these types of customizations. See ?axis for more
information on that function as well.

To your second query, the key is to note that barplot() returns the bar
midpoints, which is referenced in the Value section of ?barplot.

Thus:

mp - barplot(1:5, yaxt = n, ylim = c(0, 6))
axis(2, at = seq(0, 5, 0.25), las = 1)
text(mp, 1:5, labels = 1:5, pos = 3)

See ?text for more information.

Also, note that I increased the range of the y axis here to make room
for the bar text labels (primarily the final tallest bar).

Finally, there is an article in the R Help Desk section of the October
2003 R News on basic graphic operations in R, which you might find
helpful. A direct link to it is:

http://cran.r-project.org/doc/Rnews/Rnews_2003-2.pdf

HTH,

Marc Schwartz

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] barplot() options for intervals on axes

2004-12-06 Thread Sebastien Moretti
  Hello,
  I am a beginner with R. I read many tutorials and the FAQ but I cannot
  solve my problem.
  I use barplot() to view my graph. I try to get more interval marks on y
  axis. I wasn't able to find options in 'help(barplot)' or 'help(par)' to
  do this with barplot().
 
  I seek for another option to print y values on my bars like on the graph
  of the R homepage: http://www.r-project.org/
 
  Thanks for your help.

 The general process of customizing the annotation of the axes for a
 variety of plots is posted frequently to this e-mail list, so a search
 of the archive using axis as the keyword yields almost 2,000 hits.
 Using axis labels narrows that to 650, which are more relevant.

 The key is to inhibit the generation of the default y axis by using the
 argument 'yaxt = n':

 Compare:

 barplot(1:5)

 versus

 barplot(1:5, yaxt = n)


 You can then use the axis() function to customize the y axis values:

 barplot(1:5, yaxt = n)
 axis(2, at = seq(0, 5, 0.25), las = 1)

It's exactly what I seek for !
There are too many answers in the FAQ.
So, I use 
axis(2,at=c(0,round(max(y)/8),round(max(y)/4),round(max(y)/2),round(3*max(y)/4),max(y)))
to print the vertical axe I want.

 help(par) provides additional information on the graphic parameters,
 which are the key to these types of customizations. See ?axis for more
 information on that function as well.

 To your second query, the key is to note that barplot() returns the bar
 midpoints, which is referenced in the Value section of ?barplot.

 Thus:

 mp - barplot(1:5, yaxt = n, ylim = c(0, 6))
 axis(2, at = seq(0, 5, 0.25), las = 1)
 text(mp, 1:5, labels = 1:5, pos = 3)

The text() command prints y value labels over my bars

Maybe some examples like that should be in the R manual

Thanks

 See ?text for more information.

 Also, note that I increased the range of the y axis here to make room
 for the bar text labels (primarily the final tallest bar).

 Finally, there is an article in the R Help Desk section of the October
 2003 R News on basic graphic operations in R, which you might find
 helpful. A direct link to it is:

 http://cran.r-project.org/doc/Rnews/Rnews_2003-2.pdf

 HTH,

 Marc Schwartz

-- 
Sebastien MORETTI
Linux User - #327894
CNRS - IGS
31 chemin Joseph Aiguier
13402 Marseille cedex 20, FRANCE
tel. +33 (0)4 91 16 44 55

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] barplot() options for intervals on axes

2004-12-06 Thread Marc Schwartz
On Mon, 2004-12-06 at 16:31 +0100, Sebastien Moretti wrote:

 There are too many answers in the FAQ.

Given the discussions here of late, I suspect that there will be one or
two folks who might disagree with that statement...

;-)

Marc

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Fwd: Re: [R] barplot() options for intervals on axes

2004-12-06 Thread Sebastien Moretti
There are too many answers in the FAQ.
For this topic !

 Marc Schwartz

-- 
Sebastien MORETTI
Linux User - #327894
CNRS - IGS
31 chemin Joseph Aiguier
13402 Marseille cedex 20, FRANCE
tel. +33 (0)4 91 16 44 55

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html