[R] Help on BarPlot

Thomas Roth (geb. Kaliwe) hamstersquats at web.de
Tue Feb 10 09:30:02 CET 2009


Hi,

#There are a lot of examples for barplot if you just type

example(barplot)

# i altered one slightly to put the values on top of each bar

mp <- barplot(VADeaths)     # default
#tot <- colMeans(VADeaths)   #changed this line
tot = colSums(VADeaths)    #wether you need max, min, mean , colSums 
will depend on your data
text(mp, tot + 4, format(tot), xpd = TRUE, col = "blue")


#you should be able to get it from here


Thomas




Steve Sidney schrieb:
> Dear all
>
> As a new user of R, can someone please help me with the following
>
> I have created a programme to analyse laboratory data and one of the graphs is a bar plot of 'Z' scores.
>
> On the bar plot I am using the following line to plot some results
>
>  barplot (zb[,c("ZBW")], ylim = c(-6,6), names.arg=zb[,c("LabNo")],xlab="Lab Code Number", cex.names = .5 , axis.lty=1 , main = " Total Coliform ")
>
> What I would like to do is move the xlab parameter to sit on top or on each bar and not on the x-axis at y=0.
>
> Any help would be appreciated.
>
> Thanks
>
> Steve
> 	[[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