[R] line plot over a barplot

Petr PIKAL petr.pikal at precheza.cz
Fri Mar 16 09:45:56 CET 2012


Hi

> 
> Dear all,
> 
>             I have data in the following format :
> X-axis            Y-axis
> <0                10%
> 0-20              20%
> 20-40            30%
> 40-60            40%
> ......... and so on.
>  I want to plot a bar graph of the above. Also I would want to add a
> trendline passing either through the center of each bar or through the 
top.

x<-letters[1:5]
y<-1:5
bb<-barplot(y, names.arg=x)
lines(bb, y)
lines(bb, y/2)

> Is it also possible to get the r-squared and p-values for this 
trendline?

summary(fit<-lm(y~bb))

Regards
Petr

> How do I all of the above? I would be extremely indebted by your help.
> Thanks in advance
> 
> 
> Regards,
> 
> Anupam
> 
> 
> -- 
> Graduate Student,
> Laboratory of Computational Biology,
> Center For DNA Fingerprinting And Diagnostics,
> 4-1-714 to 725/2, Tuljaguda complex
> Mozamzahi Road, Nampally,
> Hyderabad-500001
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org 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.



More information about the R-help mailing list