[R] Question about 'lables' & ect.
Liaw, Andy
andy_liaw at merck.com
Wed Mar 15 18:28:25 CET 2006
Try something like:
xp <- barplot(test$Score, space=.5)
axis(1, at=xp, labels=as.character(test$Name))
See ?barplot more more detail.
Andy
From: jia ding
>
> Hi,
>
> I have a file named:
> test_R.txt
> aaa 2
> bbb 5
> ccc 7
> sss 3
> xxx 8
>
> I want to have a plot:
> test<-read.table("test_R.txt",col.name=c("Name","Score"))
> par(mfrow=c(1,2))
> barplot(test$Score)
> name<-test$Name
> axis(1,at=1:length(test$Name),labels=paste(name))
>
> Q1, if you try the script above,you will get 5 bars, the axis
> only shows "aaa", "ccc","xxx", but where are "bbb"&"sss"?
>
> Q2, pls have a look this x-axis again, you will find the
> middle of the bars are not pointing to the x-axes.
>
> Q3, how can i change the width of the bars? I feel they are too "fat".
>
> Thanks!
> Nina
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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
>
>
More information about the R-help
mailing list