From: Marc Schwartz <MSchwartz_at_mn.rr.com>

Date: Sun 15 Oct 2006 - 15:52:03 GMT

R-help@stat.math.ethz.ch 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. Received on Mon Oct 16 02:41:25 2006

Date: Sun 15 Oct 2006 - 15:52:03 GMT

On Sat, 2006-10-14 at 23:52 -0400, Mohsen Jafarikia wrote:

> Hello everyone,

*>
**> I have the following program to draw a barplot.
**>
**>
**>
**> MP<-read.table(file='AR.out')
**>
**> names(MP)<-c('BN','BL','LR','Q')
**>
**> Graph<- barplot(MP$LR, main='LR Value', col='orange', border='black', space=
**> 0.05, width=(MP$BL), xlab='Length', ylab='LR each')
**>
**> axis(1, at=Graph, sprintf('%0.2f',MP$BL))
**>
**> mtext(1, at=Graph, text=sprintf('%0.2f',MP$Q), line=2)
**>
**> mtext(1, at=par('usr')[1], text='BL', line=1)
**>
**> mtext(1, at=par('usr')[1], text='Var', line=2)
**>
**> abline(h=3.841,col='blue')
**>
**> abline(h=6.635,col='red')
**>
**>
**>
**> I have two more questions about the graph that I have:
**>
**> 1) I want to write the 'Q' only when it is not equal to zero.
**>
**> 2) I would like to change the bars when 'Q' is not zero. For example, from
**> orange to green.
**>
**>
**>
**> I would appreciate your input to this question.
**> Thanks,
**>
**> Mohsen
*

It would be helpful to have the data that you are working with so that we can provide each other a working example.

However, here are some hints:

1.

mtext(1, at = Graph,

text = ifelse(MP$Q != 0, sprintf('%0.2f',MP$Q), ""), line=2)

2.

cols <- ifelse(MP$Q != 0, "orange", "green") barplot(..., col = cols, ...)

See ?ifelse

**HTH,
**
Marc Schwartz

R-help@stat.math.ethz.ch 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. Received on Mon Oct 16 02:41:25 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Sun 15 Oct 2006 - 21:30:10 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*