Hello list I am trying to solve a problem when drawing a figure related to the dataframe below. I draw V6 in Y axes and V3 as X axes. The data are grouped by V1 AND V2. I use this commande to make it: xyplot(cm[,6]~cm[,3],type="b",group=interaction(cm[,1],cm[,2],sep="/"), auto.key =list( title="Makespan en fonction de beta", points = FALSE, columns=2, lines = TRUE) ,data=cm,xlab=expression(beta),ylab="Ratio") The problem is that, R puts (for example) the entry C/D in the legend, however, I have no such entry. Note that R it does not draw a line for that entry. So, the question : how to do to remove the empty groups from the legend. Cordially> cmV1 V2 V3 V4 V5 V6 1 C L 0.0 732179.0 686983 1.065789 2 C L 0.2 900956.4 686983 1.311468 3 C L 0.4 964725.0 686983 1.404292 4 C L 0.6 1017984.0 686983 1.481818 5 C L 0.8 1064745.8 686983 1.549887 6 C L 1.0 1107269.0 686983 1.611785 7 C S 0.0 803926.0 686983 1.170227 8 C S 0.2 1020492.0 686983 1.485469 9 C S 0.4 1134818.0 686983 1.651887 10 C S 0.6 1223596.0 686983 1.781115 11 C S 0.8 1322548.8 686983 1.925155 12 C S 1.0 1395714.0 686983 2.031657 13 I L 0.0 2628113.0 686983 3.825587 14 I L 0.2 2628113.0 686983 3.825587 15 I L 0.4 2628113.0 686983 3.825587 16 I L 0.6 2628113.0 686983 3.825587 17 I L 0.8 2628113.0 686983 3.825587 18 I L 1.0 2628113.0 686983 3.825587 19 I S 0.0 2628113.0 686983 3.825587 20 I S 0.2 2628113.0 686983 3.825587 21 I S 0.4 2475448.0 686983 3.603361 22 I S 0.6 2475448.0 686983 3.603361 23 I S 0.8 2475448.0 686983 3.603361 24 I S 1.0 2475448.0 686983 3.603361 25 I F 0.0 871670.0 686983 1.268838 26 I F 0.2 1066742.0 686983 1.552792 27 I F 0.4 1136213.0 686983 1.653917 28 I F 0.6 1210547.0 686983 1.762121 29 I F 0.8 1256777.0 686983 1.829415 30 I F 1.0 1304294.0 686983 1.898583 31 I I 0.0 897718.0 686983 1.306754 32 I I 0.2 1123968.0 686983 1.636093 33 I I 0.4 1301097.0 686983 1.893929 34 I I 0.6 1373663.0 686983 1.999559 35 I I 0.8 1424121.0 686983 2.073008 36 I I 1.0 1542813.0 686983 2.245780 37 I D 0.0 937621.0 686983 1.364839 38 I D 0.2 1205063.0 686983 1.754138 39 I D 0.4 1341839.0 686983 1.953235 40 I D 0.6 1431970.0 686983 2.084433 41 I D 0.8 1538944.0 686983 2.240149 42 I D 1.0 1670073.0 686983 2.431025 43 D L 0.0 731904.0 686983 1.065389 44 D L 0.2 900183.0 686983 1.310342 45 D L 0.4 964870.1 686983 1.404504 46 D L 0.6 1017462.8 686983 1.481060 47 D L 0.8 1064435.2 686983 1.549435 48 D L 1.0 1107595.0 686983 1.612260 49 D S 0.0 798289.0 686983 1.162022 50 D S 0.2 1014643.2 686983 1.476955 51 D S 0.4 1125711.8 686983 1.638631 52 D S 0.6 1220923.0 686983 1.777224 53 D S 0.8 1306571.2 686983 1.901897 54 D S 1.0 1399836.0 686983 2.037657 55 D F 0.0 724924.0 686983 1.055229 56 D F 0.2 935413.5 686983 1.361625 57 D F 0.4 1011621.9 686983 1.472557 58 D F 0.6 1071081.6 686983 1.559109 59 D F 0.8 1139325.8 686983 1.658448 60 D F 1.0 1181282.1 686983 1.719522 61 D I 0.0 755841.0 686983 1.100232 62 D I 0.2 964335.0 686983 1.403725 63 D I 0.4 1051233.4 686983 1.530218 64 D I 0.6 1110842.0 686983 1.616986 65 D I 0.8 1193509.0 686983 1.737320 66 D I 1.0 1264249.0 686983 1.840292 67 D D 0.0 751660.0 686983 1.094146 68 D D 0.2 1019735.0 686983 1.484367 69 D D 0.4 1101191.0 686983 1.602938 70 D D 0.6 1191547.0 686983 1.734464 71 D D 0.8 1293433.0 686983 1.882773 72 D D 1.0 1340360.0 686983 1.951082 [[alternative HTML version deleted]]
hello, I attach the figure generated by R: 2013/5/8 Adel ESSAFI <adelessafi at gmail.com>> Hello list > I am trying to solve a problem when drawing a figure related to the > dataframe below. > I draw V6 in Y axes and V3 as X axes. The data are grouped by V1 AND V2. > I use this commande to make it: > > xyplot(cm[,6]~cm[,3],type="b",group=interaction(cm[,1],cm[,2],sep="/"), > auto.key =list( title="Makespan en fonction de beta", points = FALSE, > columns=2, lines = TRUE) > ,data=cm,xlab=expression(beta),ylab="Ratio") > > The problem is that, R puts (for example) the entry C/D in the legend, > however, I have no such entry. Note that R it does not draw a line for that > entry. > > So, the question : how to do to remove the empty groups from the legend. > > Cordially > > > > > > cm > V1 V2 V3 V4 V5 V6 > 1 C L 0.0 732179.0 686983 1.065789 > 2 C L 0.2 900956.4 686983 1.311468 > 3 C L 0.4 964725.0 686983 1.404292 > 4 C L 0.6 1017984.0 686983 1.481818 > 5 C L 0.8 1064745.8 686983 1.549887 > 6 C L 1.0 1107269.0 686983 1.611785 > 7 C S 0.0 803926.0 686983 1.170227 > 8 C S 0.2 1020492.0 686983 1.485469 > 9 C S 0.4 1134818.0 686983 1.651887 > 10 C S 0.6 1223596.0 686983 1.781115 > 11 C S 0.8 1322548.8 686983 1.925155 > 12 C S 1.0 1395714.0 686983 2.031657 > 13 I L 0.0 2628113.0 686983 3.825587 > 14 I L 0.2 2628113.0 686983 3.825587 > 15 I L 0.4 2628113.0 686983 3.825587 > 16 I L 0.6 2628113.0 686983 3.825587 > 17 I L 0.8 2628113.0 686983 3.825587 > 18 I L 1.0 2628113.0 686983 3.825587 > 19 I S 0.0 2628113.0 686983 3.825587 > 20 I S 0.2 2628113.0 686983 3.825587 > 21 I S 0.4 2475448.0 686983 3.603361 > 22 I S 0.6 2475448.0 686983 3.603361 > 23 I S 0.8 2475448.0 686983 3.603361 > 24 I S 1.0 2475448.0 686983 3.603361 > 25 I F 0.0 871670.0 686983 1.268838 > 26 I F 0.2 1066742.0 686983 1.552792 > 27 I F 0.4 1136213.0 686983 1.653917 > 28 I F 0.6 1210547.0 686983 1.762121 > 29 I F 0.8 1256777.0 686983 1.829415 > 30 I F 1.0 1304294.0 686983 1.898583 > 31 I I 0.0 897718.0 686983 1.306754 > 32 I I 0.2 1123968.0 686983 1.636093 > 33 I I 0.4 1301097.0 686983 1.893929 > 34 I I 0.6 1373663.0 686983 1.999559 > 35 I I 0.8 1424121.0 686983 2.073008 > 36 I I 1.0 1542813.0 686983 2.245780 > 37 I D 0.0 937621.0 686983 1.364839 > 38 I D 0.2 1205063.0 686983 1.754138 > 39 I D 0.4 1341839.0 686983 1.953235 > 40 I D 0.6 1431970.0 686983 2.084433 > 41 I D 0.8 1538944.0 686983 2.240149 > 42 I D 1.0 1670073.0 686983 2.431025 > 43 D L 0.0 731904.0 686983 1.065389 > 44 D L 0.2 900183.0 686983 1.310342 > 45 D L 0.4 964870.1 686983 1.404504 > 46 D L 0.6 1017462.8 686983 1.481060 > 47 D L 0.8 1064435.2 686983 1.549435 > 48 D L 1.0 1107595.0 686983 1.612260 > 49 D S 0.0 798289.0 686983 1.162022 > 50 D S 0.2 1014643.2 686983 1.476955 > 51 D S 0.4 1125711.8 686983 1.638631 > 52 D S 0.6 1220923.0 686983 1.777224 > 53 D S 0.8 1306571.2 686983 1.901897 > 54 D S 1.0 1399836.0 686983 2.037657 > 55 D F 0.0 724924.0 686983 1.055229 > 56 D F 0.2 935413.5 686983 1.361625 > 57 D F 0.4 1011621.9 686983 1.472557 > 58 D F 0.6 1071081.6 686983 1.559109 > 59 D F 0.8 1139325.8 686983 1.658448 > 60 D F 1.0 1181282.1 686983 1.719522 > 61 D I 0.0 755841.0 686983 1.100232 > 62 D I 0.2 964335.0 686983 1.403725 > 63 D I 0.4 1051233.4 686983 1.530218 > 64 D I 0.6 1110842.0 686983 1.616986 > 65 D I 0.8 1193509.0 686983 1.737320 > 66 D I 1.0 1264249.0 686983 1.840292 > 67 D D 0.0 751660.0 686983 1.094146 > 68 D D 0.2 1019735.0 686983 1.484367 > 69 D D 0.4 1101191.0 686983 1.602938 > 70 D D 0.6 1191547.0 686983 1.734464 > 71 D D 0.8 1293433.0 686983 1.882773 > 72 D D 1.0 1340360.0 686983 1.951082 > >-- 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: cmax.pdf Type: application/pdf Size: 5930 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130508/85492251/attachment.pdf>
try using: group = factor(paste(cm[, 1], cm[, 2], sep = '/')) instead of group=interaction(cm[,1],cm[,2],sep="/") On Wed, May 8, 2013 at 4:25 AM, Adel ESSAFI <adelessafi@gmail.com> wrote:> Hello list > I am trying to solve a problem when drawing a figure related to the > dataframe below. > I draw V6 in Y axes and V3 as X axes. The data are grouped by V1 AND V2. > I use this commande to make it: > > xyplot(cm[,6]~cm[,3],type="b",group=interaction(cm[,1],cm[,2],sep="/"), > auto.key =list( title="Makespan en fonction de beta", points = FALSE, > columns=2, lines = TRUE) > ,data=cm,xlab=expression(beta),ylab="Ratio") > > The problem is that, R puts (for example) the entry C/D in the legend, > however, I have no such entry. Note that R it does not draw a line for that > entry. > > So, the question : how to do to remove the empty groups from the legend. > > Cordially > > > > > > cm > V1 V2 V3 V4 V5 V6 > 1 C L 0.0 732179.0 686983 1.065789 > 2 C L 0.2 900956.4 686983 1.311468 > 3 C L 0.4 964725.0 686983 1.404292 > 4 C L 0.6 1017984.0 686983 1.481818 > 5 C L 0.8 1064745.8 686983 1.549887 > 6 C L 1.0 1107269.0 686983 1.611785 > 7 C S 0.0 803926.0 686983 1.170227 > 8 C S 0.2 1020492.0 686983 1.485469 > 9 C S 0.4 1134818.0 686983 1.651887 > 10 C S 0.6 1223596.0 686983 1.781115 > 11 C S 0.8 1322548.8 686983 1.925155 > 12 C S 1.0 1395714.0 686983 2.031657 > 13 I L 0.0 2628113.0 686983 3.825587 > 14 I L 0.2 2628113.0 686983 3.825587 > 15 I L 0.4 2628113.0 686983 3.825587 > 16 I L 0.6 2628113.0 686983 3.825587 > 17 I L 0.8 2628113.0 686983 3.825587 > 18 I L 1.0 2628113.0 686983 3.825587 > 19 I S 0.0 2628113.0 686983 3.825587 > 20 I S 0.2 2628113.0 686983 3.825587 > 21 I S 0.4 2475448.0 686983 3.603361 > 22 I S 0.6 2475448.0 686983 3.603361 > 23 I S 0.8 2475448.0 686983 3.603361 > 24 I S 1.0 2475448.0 686983 3.603361 > 25 I F 0.0 871670.0 686983 1.268838 > 26 I F 0.2 1066742.0 686983 1.552792 > 27 I F 0.4 1136213.0 686983 1.653917 > 28 I F 0.6 1210547.0 686983 1.762121 > 29 I F 0.8 1256777.0 686983 1.829415 > 30 I F 1.0 1304294.0 686983 1.898583 > 31 I I 0.0 897718.0 686983 1.306754 > 32 I I 0.2 1123968.0 686983 1.636093 > 33 I I 0.4 1301097.0 686983 1.893929 > 34 I I 0.6 1373663.0 686983 1.999559 > 35 I I 0.8 1424121.0 686983 2.073008 > 36 I I 1.0 1542813.0 686983 2.245780 > 37 I D 0.0 937621.0 686983 1.364839 > 38 I D 0.2 1205063.0 686983 1.754138 > 39 I D 0.4 1341839.0 686983 1.953235 > 40 I D 0.6 1431970.0 686983 2.084433 > 41 I D 0.8 1538944.0 686983 2.240149 > 42 I D 1.0 1670073.0 686983 2.431025 > 43 D L 0.0 731904.0 686983 1.065389 > 44 D L 0.2 900183.0 686983 1.310342 > 45 D L 0.4 964870.1 686983 1.404504 > 46 D L 0.6 1017462.8 686983 1.481060 > 47 D L 0.8 1064435.2 686983 1.549435 > 48 D L 1.0 1107595.0 686983 1.612260 > 49 D S 0.0 798289.0 686983 1.162022 > 50 D S 0.2 1014643.2 686983 1.476955 > 51 D S 0.4 1125711.8 686983 1.638631 > 52 D S 0.6 1220923.0 686983 1.777224 > 53 D S 0.8 1306571.2 686983 1.901897 > 54 D S 1.0 1399836.0 686983 2.037657 > 55 D F 0.0 724924.0 686983 1.055229 > 56 D F 0.2 935413.5 686983 1.361625 > 57 D F 0.4 1011621.9 686983 1.472557 > 58 D F 0.6 1071081.6 686983 1.559109 > 59 D F 0.8 1139325.8 686983 1.658448 > 60 D F 1.0 1181282.1 686983 1.719522 > 61 D I 0.0 755841.0 686983 1.100232 > 62 D I 0.2 964335.0 686983 1.403725 > 63 D I 0.4 1051233.4 686983 1.530218 > 64 D I 0.6 1110842.0 686983 1.616986 > 65 D I 0.8 1193509.0 686983 1.737320 > 66 D I 1.0 1264249.0 686983 1.840292 > 67 D D 0.0 751660.0 686983 1.094146 > 68 D D 0.2 1019735.0 686983 1.484367 > 69 D D 0.4 1101191.0 686983 1.602938 > 70 D D 0.6 1191547.0 686983 1.734464 > 71 D D 0.8 1293433.0 686983 1.882773 > 72 D D 1.0 1340360.0 686983 1.951082 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. >-- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. [[alternative HTML version deleted]]