Re: [R] BarPlot

From: Mohsen Jafarikia <jafarikia_at_gmail.com>
Date: Sun 15 Oct 2006 - 20:41:09 GMT

Hello again,

Thanks for answering my questions.
If my program is now:

 pdf('Test.pdf')

BL<-c(1.97,8.04,2.54,10.53,4.85,1.73)
LR<-c(0.85,0.86,8.33,04.18,6.26,2.40)
 Q<-c(0.00,0.00,1.92,01.92,4.48,0.00)

 cols <- ifelse(Q!=0, "orange", "green") Graph<- barplot(LR, main='LR Value',col=cols, border='black', space=0.05, width=(BL), xlab='Length', ylab='LR block')

axis(1, at=Graph, sprintf('%0.2f',BL))

mtext(1, at=Graph, text=ifelse(Q!=0, sprintf('%0.2f',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.8, col='blue') <<<<<<<<<< I want to add "alpha=5%" at the end of this line

 And now I want to write "alpha=5%" at the end of the line that I have on my graph.

Thanks,
Mohsen

On 10/15/06, Marc Schwartz <MSchwartz@mn.rr.com> wrote:
>
> 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
>
>
>

        [[alternative HTML version deleted]]



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 06:48:51 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.