Hi message, What you can do is this: barpos<-barplot(axes=FALSE, ann=FALSE, horiz=TRUE, testbarplot[,2], ylab='group', xlab= '(x values)', xlim=c(0,10),space=c(1,0,0,0, 1,0,0,0)) text(testbarplot[,2],barpos, c('a', 'b', 'c', 'd', 'c', 'e','f', 'g'), pos=4)
as I think you want the values displayed just to the right of the bars. The "xlim" argument is needed to provide space for the label on the longest bar. Jim > -----Original Message----- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of message > Sent: Monday, April 4, 2016 6:00 AM > To: r-help@r-project.org > Subject: [R] multiple bar plot annotation text labelling > > Readers, > > The attempt is to create a bar plot with text labels adjacent to each > datum value. > > Data file: > 1,3,A > 1,8,B > 1,1,C > 1,9,D > 2,5,C > 2,4,E > 2,2,F > 2,0,G > > testbarplot<-read.csv('data1.csv', header=FALSE) > barplot(axes=FALSE, ann=FALSE, horiz=TRUE, testbarplot[,2], ylab= > 'group', xlab= '(x values)', space=c(1,0,0,0, 1,0,0,0)) > text(testbarplot[,2], testbarplot[,1], c('a', 'b', 'c', 'd', 'c', 'e', > 'f', 'g'), pos=4) > > Why does the text labels only appear for the lower half group of bar > plot values? > > Below is an example of the type of graph that is being sought. It is svg > text exported from libreoffice calc that should be saved as a separate > file and viewable in any svg viewer such as a web browser or a tool such > as 'eye of gnome'. > > <?xml version="1.0" encoding="UTF-8"?> > > <svg version="1.2" baseProfile="tiny" width="115.01mm" height="126.01mm" > viewBox="1200 2000 11501 12601" preserveAspectRatio="xMidYMid" > fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" > xmlns="http://www.w3.org/2000/svg" > xmlns:ooo="http://xml.openoffice.org/svg/export" > xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"> > <defs class="ClipPathGroup"> > <clipPath id="presentation_clip_path" clipPathUnits="userSpaceOnUse"> > <rect x="1200" y="2000" width="11501" height="12601"/> > </clipPath> > </defs> > <defs> > <font id="EmbeddedFont_1" horiz-adv-x="2048"> > <font-face font-family="Liberation Sans embedded" units-per-em="2048" > font-weight="normal" font-style="normal" ascent="1852" descent="423"/> > <missing-glyph horiz-adv-x="2048" d="M 0,0 L 2047,0 2047,2047 0,2047 > 0,0 Z"/> > <glyph unicode="1" horiz-adv-x="927" d="M 156,0 L 156,153 515,153 > 515,1237 197,1010 197,1180 530,1409 696,1409 696,153 1039,153 1039,0 > 156,0 Z"/> > </font> > </defs> > <defs class="TextShapeIndex"> > <g ooo:slide="id1" ooo:id-list="id3 id4 id5 id6 id7 id8 id9 id10 id11 > id12 id13 id14 id15 id16 id17 id18 id19 id20 id21"/> > </defs> > <defs class="EmbeddedBulletChars"> > <g id="bullet-char-template(57356)" > transform="scale(0.00048828125,-0.00048828125)"> > <path d="M 580,1141 L 1163,571 580,0 -4,571 580,1141 Z"/> > </g> > <g id="bullet-char-template(57354)" > transform="scale(0.00048828125,-0.00048828125)"> > <path d="M 8,1128 L 1137,1128 1137,0 8,0 8,1128 Z"/> > </g> > <g id="bullet-char-template(10146)" > transform="scale(0.00048828125,-0.00048828125)"> > <path d="M 174,0 L 602,739 174,1481 1456,739 174,0 Z M 1358,739 L > 309,1346 659,739 1358,739 Z"/> > </g> > <g id="bullet-char-template(10132)" > transform="scale(0.00048828125,-0.00048828125)"> > <path d="M 2015,739 L 1276,0 717,0 1260,543 174,543 174,936 1260,936 > 717,1481 1274,1481 2015,739 Z"/> > </g> > <g id="bullet-char-template(10007)" > transform="scale(0.00048828125,-0.00048828125)"> > <path d="M 0,-2 C -7,14 -16,27 -25,37 L 356,567 C 262,823 215,952 > 215,954 215,979 228,992 255,992 264,992 276,990 289,987 310,991 331,999 > 354,1012 L 381,999 492,748 772,1049 836,1024 860,1049 C 881,1039 > 901,1025 922,1006 886,937 835,863 770,784 769,783 710,716 594,584 L > 774,223 C 774,196 753,168 711,139 L 727,119 C 717,90 699,76 672,76 > 641,76 570,178 457,381 L 164,-76 C 142,-110 111,-127 72,-127 30,-127 > 9,-110 8,-76 1,-67 -2,-52 -2,-32 -2,-23 -1,-13 0,-2 Z"/> > </g> > <g id="bullet-char-template(10004)" > transform="scale(0.00048828125,-0.00048828125)"> > <path d="M 285,-33 C 182,-33 111,30 74,156 52,228 41,333 41,471 > 41,549 55,616 82,672 116,743 169,778 240,778 293,778 328,747 346,684 L > 369,508 C 377,444 397,411 428,410 L 1163,1116 C 1174,1127 1196,1133 > 1229,1133 1271,1133 1292,1118 1292,1087 L 1292,965 C 1292,929 1282,901 > 1262,881 L 442,47 C 390,-6 338,-33 285,-33 Z"/> > </g> > <g id="bullet-char-template(9679)" > transform="scale(0.00048828125,-0.00048828125)"> > <path d="M 813,0 C 632,0 489,54 383,161 276,268 223,411 223,592 > 223,773 276,916 383,1023 489,1130 632,1184 813,1184 992,1184 1136,1130 > 1245,1023 1353,916 1407,772 1407,592 1407,412 1353,268 1245,161 1136,54 > 992,0 813,0 Z"/> > </g> > <g id="bullet-char-template(8226)" > transform="scale(0.00048828125,-0.00048828125)"> > <path d="M 346,457 C 273,457 209,483 155,535 101,586 74,649 74,723 > 74,796 101,859 155,911 209,963 273,989 346,989 419,989 480,963 531,910 > 582,859 608,796 608,723 608,648 583,586 532,535 482,483 420,457 346,457 > Z"/> > </g> > <g id="bullet-char-template(8211)" > transform="scale(0.00048828125,-0.00048828125)"> > <path d="M -4,459 L 1135,459 1135,606 -4,606 -4,459 Z"/> > </g> > </defs> > <defs class="TextEmbeddedBitmaps"/> > <g class="SlideGroup"> > <g> > <g id="id1" class="Slide" clip-path="url(#presentation_clip_path)"> > <g class="Page"> > <g class="com.sun.star.drawing.CustomShape"> > <g id="id3"> > <path fill="rgb(114,159,207)" stroke="none" d="M 4350,3000 L > 3000,3000 3000,2100 5700,2100 5700,3000 4350,3000 Z"/> > <path fill="none" stroke="rgb(52,101,164)" d="M 4350,3000 L > 3000,3000 3000,2100 5700,2100 5700,3000 4350,3000 Z"/> > </g> > </g> > <g class="com.sun.star.drawing.CustomShape"> > <g id="id4"> > <path fill="rgb(114,159,207)" stroke="none" d="M 5350,3900 L > 3000,3900 3000,3000 7700,3000 7700,3900 5350,3900 Z"/> > <path fill="none" stroke="rgb(52,101,164)" d="M 5350,3900 L > 3000,3900 3000,3000 7700,3000 7700,3900 5350,3900 Z"/> > </g> > </g> > <g class="com.sun.star.drawing.CustomShape"> > <g id="id5"> > <path fill="rgb(114,159,207)" stroke="none" d="M 3800,4800 L > 3000,4800 3000,3900 4600,3900 4600,4800 3800,4800 Z"/> > <path fill="none" stroke="rgb(52,101,164)" d="M 3800,4800 L > 3000,4800 3000,3900 4600,3900 4600,4800 3800,4800 Z"/> > </g> > </g> > <g class="com.sun.star.drawing.CustomShape"> > <g id="id6"> > <path fill="rgb(114,159,207)" stroke="none" d="M 7850,5700 L > 3000,5700 3000,4800 12700,4800 12700,5700 7850,5700 Z"/> > <path fill="none" stroke="rgb(52,101,164)" d="M 7850,5700 L > 3000,5700 3000,4800 12700,4800 12700,5700 7850,5700 Z"/> > </g> > </g> > <g class="com.sun.star.drawing.CustomShape"> > <g id="id7"> > <path fill="rgb(114,159,207)" stroke="none" d="M 4350,7500 L > 3000,7500 3000,6600 5700,6600 5700,7500 4350,7500 Z"/> > <path fill="none" stroke="rgb(52,101,164)" d="M 4350,7500 L > 3000,7500 3000,6600 5700,6600 5700,7500 4350,7500 Z"/> > </g> > </g> > <g class="com.sun.star.drawing.CustomShape"> > <g id="id8"> > <path fill="rgb(114,159,207)" stroke="none" d="M 5350,8400 L > 3000,8400 3000,7500 7700,7500 7700,8400 5350,8400 Z"/> > <path fill="none" stroke="rgb(52,101,164)" d="M 5350,8400 L > 3000,8400 3000,7500 7700,7500 7700,8400 5350,8400 Z"/> > </g> > </g> > <g class="com.sun.star.drawing.CustomShape"> > <g id="id9"> > <path fill="rgb(114,159,207)" stroke="none" d="M 3800,9300 L > 3000,9300 3000,8400 4600,8400 4600,9300 3800,9300 Z"/> > <path fill="none" stroke="rgb(52,101,164)" d="M 3800,9300 L > 3000,9300 3000,8400 4600,8400 4600,9300 3800,9300 Z"/> > </g> > </g> > <g class="com.sun.star.drawing.CustomShape"> > <g id="id10"> > <path fill="rgb(114,159,207)" stroke="none" d="M 7850,10200 L > 3000,10200 3000,9300 12700,9300 12700,10200 7850,10200 Z"/> > <path fill="none" stroke="rgb(52,101,164)" d="M 7850,10200 L > 3000,10200 3000,9300 12700,9300 12700,10200 7850,10200 Z"/> > </g> > </g> > <g class="com.sun.star.drawing.CustomShape"> > <g id="id11"> > <path fill="rgb(114,159,207)" stroke="none" d="M 4350,11900 L > 3000,11900 3000,11000 5700,11000 5700,11900 4350,11900 Z"/> > <path fill="none" stroke="rgb(52,101,164)" d="M 4350,11900 L > 3000,11900 3000,11000 5700,11000 5700,11900 4350,11900 Z"/> > </g> > </g> > <g class="com.sun.star.drawing.CustomShape"> > <g id="id12"> > <path fill="rgb(114,159,207)" stroke="none" d="M 5350,12800 L > 3000,12800 3000,11900 7700,11900 7700,12800 5350,12800 Z"/> > <path fill="none" stroke="rgb(52,101,164)" d="M 5350,12800 L > 3000,12800 3000,11900 7700,11900 7700,12800 5350,12800 Z"/> > </g> > </g> > <g class="com.sun.star.drawing.CustomShape"> > <g id="id13"> > <path fill="rgb(114,159,207)" stroke="none" d="M 3800,13700 L > 3000,13700 3000,12800 4600,12800 4600,13700 3800,13700 Z"/> > <path fill="none" stroke="rgb(52,101,164)" d="M 3800,13700 L > 3000,13700 3000,12800 4600,12800 4600,13700 3800,13700 Z"/> > </g> > </g> > <g class="com.sun.star.drawing.CustomShape"> > <g id="id14"> > <path fill="rgb(114,159,207)" stroke="none" d="M 7850,14600 L > 3000,14600 3000,13700 12700,13700 12700,14600 7850,14600 Z"/> > <path fill="none" stroke="rgb(52,101,164)" d="M 7850,14600 L > 3000,14600 3000,13700 12700,13700 12700,14600 7850,14600 Z"/> > </g> > </g> > <g class="com.sun.star.drawing.LineShape"> > <g id="id15"> > <path fill="none" stroke="rgb(0,0,0)" d="M 2500,2000 L > 2400,14600"/> > </g> > </g> > <g class="com.sun.star.drawing.LineShape"> > <g id="id16"> > <path fill="none" stroke="rgb(0,0,0)" d="M 2500,3900 L > 2000,3900"/> > </g> > </g> > <g class="com.sun.star.drawing.LineShape"> > <g id="id17"> > <path fill="none" stroke="rgb(0,0,0)" d="M 2450,8400 L > 1950,8400"/> > </g> > </g> > <g class="com.sun.star.drawing.LineShape"> > <g id="id18"> > <path fill="none" stroke="rgb(0,0,0)" d="M 2450,12900 L > 1950,12900"/> > </g> > </g> > <g class="com.sun.star.drawing.TextShape"> > <g id="id19"> > <text class="TextShape"><tspan class="TextParagraph" > font-family="Liberation Sans, sans-serif" font-size="635px" > font-weight="400"><tspan class="TextPosition" x="1450" y="4201"/><tspan > class="TextPosition" x="1450" y="4201"><tspan fill="rgb(0,0,0)" > stroke="none">1</tspan></tspan></tspan></text> > </g> > </g> > <g class="com.sun.star.drawing.TextShape"> > <g id="id20"> > <text class="TextShape"><tspan class="TextParagraph" > font-family="Liberation Sans, sans-serif" font-size="635px" > font-weight="400"><tspan class="TextPosition" x="1451" y="8701"/><tspan > class="TextPosition" x="1451" y="8701"><tspan fill="rgb(0,0,0)" > stroke="none">1</tspan></tspan></tspan></text> > </g> > </g> > <g class="com.sun.star.drawing.TextShape"> > <g id="id21"> > <text class="TextShape"><tspan class="TextParagraph" > font-family="Liberation Sans, sans-serif" font-size="635px" > font-weight="400"><tspan class="TextPosition" x="1452" y="13201"/><tspan > class="TextPosition" x="1452" y="13201"><tspan fill="rgb(0,0,0)" > stroke="none">1</tspan></tspan></tspan></text> > </g> > </g> > </g> > </g> > </g> > </g> > </svg> > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.