[R] legend for bar plot ?

arun smartpink111 at yahoo.com
Tue Nov 26 21:23:24 CET 2013


Hi,
May be:

barplot(m$V3,names.arg=paste(m$V2,m$V1,sep="\n"),col=rainbow(10))
#or
barplot(m$V3,names.arg=m$V2,col=rainbow(20),legend=m$V1, args.legend = list(x = "topright",box.lwd=0,border=FALSE))
A.K.




On Tuesday, November 26, 2013 1:18 PM, Adel ESSAFI <adelessafi at gmail.com> wrote:
Hello;
I have the following table
> m
    V2 V1      V3
1  C/L  0  732179
3  C/S  0  803926
19 D/F  0  724924
17 D/I  0  755841
13 D/L  0  731904
15 D/S  0  798289
11 I/F  0  871670
9  I/I  0  897718
5  I/L  0 2628113
7  I/S  0 2628113
2  C/L  1 1107269
4  C/S  1 1395714
20 D/F  1 1181282
18 D/I  1 1264249
14 D/L  1 1107595
16 D/S  1 1399836
12 I/F  1 1304294
10 I/I  1 1542813
6  I/L  1 2628113
8  I/S  1 2475448
as you can see, the table is sorted by the second and the first column.
with this command :
barplot(m$V3,names.arg=m$V2,col=rainbow(10))
I succeded to print the figure attached.
Now, I need to indicate that the first 10 bar are for beta=0 and the second
10 bars are for beta=1.
Could you help please.
Best regards


-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

    [[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