[R] Draw vertical line segments between pairs of points

Jim Lemon jim at bitwrit.com.au
Fri Feb 3 09:59:39 CET 2012

On 02/03/2012 12:07 AM, Mohamed Lajnef wrote:
> Dear all,
> How to add /*vertical*/ lines above bar graph to display p-values  (
> between pairs of points )?
Hi Mohamed,
The "segments" function will do this, but I'm not quite sure of what you 
want to display. Let's say you have a bar plot like this:

xpos<-barplot(heights,ylim=c(0,10),main="The Bar Plot",

The centers of the bars are now in "xpos", and the heights of the bars 
are in "heights". To draw vertical lines of one unit length above each bar:


If you want to display p-values above each bar:


Is that the idea?


More information about the R-help mailing list