Skip to content

legend for bar plot ?

2 messages · Adel ESSAFI, arun

#
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
? ? 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