Re: [R] improving barplot output

2006-11-19 Thread Chuck Cleland
Bob Green wrote:
> Hello,
> 
> I was hoping for some advice on improving a barplot. Below is the syntax I 
> have used. I wanted to do two things differently How would I alter the 
> syntax so that (a) the y-axis finishes at 25 and not 20, and (b) 'past 
> ideation' and 'pastwk ideation' are coloured blue and 'past attempt' & 
> 'past wk attempt' are coloured red ?
> 
> I was also curious as to whether it is possible to insert values into the 
> respective bars?
> 
>> summarizedData = c(24,4,7,1.9)
>> theNames = c("Past ideation","Past attempt", "Pastwk idea","Past wk attempt")
>> names(summarizedData) = theNames
>> barplot(summarizedData, ylab = "percentage", col="dark red")
> 
> Any assistance is appreciated,

X <- barplot(c(24,4,7,1.9), ylab="Percentage",
 col=c("dark blue","dark red"),
 ylim=c(0,25),
 names.arg = c("Past ideation","Past attempt",
   "Pastwk idea","Past wk attempt"))

text(x=X, y=c(24,4,7,1.9) - 0.5, labels=c(24,4,7,1.9), col="white")

> regards
> 
> Bob Green
> 
> __
> [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
> and provide commented, minimal, self-contained, reproducible code.
> 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] improving barplot output

2006-11-19 Thread Johan Sandblom
2006/11/19, Bob Green <[EMAIL PROTECTED]>:
>
> Hello,
>
> I was hoping for some advice on improving a barplot. Below is the syntax I
> have used. I wanted to do two things differently How would I alter the
> syntax so that (a) the y-axis finishes at 25 and not 20, and (b) 'past
> ideation' and 'pastwk ideation' are coloured blue and 'past attempt' &
> 'past wk attempt' are coloured red ?

barplot(bob,ylab="Percentage",col=rep(c("dark blue","dark red"), 2),
ylim=c(0,25))

>
> I was also curious as to whether it is possible to insert values into the
> respective bars?

?text

Regards, Johan
> >summarizedData = c(24,4,7,1.9)
> >theNames = c("Past ideation","Past attempt", "Pastwk idea","Past wk attempt")
> >names(summarizedData) = theNames
> >barplot(summarizedData, ylab = "percentage", col="dark red")
>
> Any assistance is appreciated,
>
> regards
>
> Bob Green
>
> __
> [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
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Johan Sandblom  N8, MRC, Karolinska sjh
t +46851776108  17176 Stockholm
m +46735521477  Sweden
"What is wanted is not the will to believe, but the
will to find out, which is the exact opposite"
- Bertrand Russell

__
[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] improving barplot output

2006-11-19 Thread Johan Sandblom
Sorry, that should be

barplot(summarizedData,ylab="Percentage",col=c("dark blue","dark red"),
ylim=c(0,25))



2006/11/19, Johan Sandblom <[EMAIL PROTECTED]>:
> 2006/11/19, Bob Green <[EMAIL PROTECTED]>:
> >
> > Hello,
> >
> > I was hoping for some advice on improving a barplot. Below is the syntax I
> > have used. I wanted to do two things differently How would I alter the
> > syntax so that (a) the y-axis finishes at 25 and not 20, and (b) 'past
> > ideation' and 'pastwk ideation' are coloured blue and 'past attempt' &
> > 'past wk attempt' are coloured red ?
>
> barplot(bob,ylab="Percentage",col=rep(c("dark blue","dark red"), 2),
> ylim=c(0,25))
>
> >
> > I was also curious as to whether it is possible to insert values into the
> > respective bars?
>
> ?text
>
> Regards, Johan
> > >summarizedData = c(24,4,7,1.9)
> > >theNames = c("Past ideation","Past attempt", "Pastwk idea","Past wk 
> > >attempt")
> > >names(summarizedData) = theNames
> > >barplot(summarizedData, ylab = "percentage", col="dark red")
> >
> > Any assistance is appreciated,
> >
> > regards
> >
> > Bob Green
> >
> > __
> > [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
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
> --
> Johan Sandblom  N8, MRC, Karolinska sjh
> t +46851776108  17176 Stockholm
> m +46735521477  Sweden
> "What is wanted is not the will to believe, but the
> will to find out, which is the exact opposite"
> - Bertrand Russell
>


-- 
Johan Sandblom  N8, MRC, Karolinska sjh
t +46851776108  17176 Stockholm
m +46735521477  Sweden
"What is wanted is not the will to believe, but the
will to find out, which is the exact opposite"
- Bertrand Russell

__
[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
and provide commented, minimal, self-contained, reproducible code.