[R] Fwd: Plot the means with simultaneous horizontal and vertical error bars

Marc Girondot marc_grt at yahoo.fr
Sat Jul 19 01:44:38 CEST 2014


In the package phenology (in CRAN), I add a function plot_errbar:
plot_errbar(..., errbar.x = NULL, errbar.y = NULL, errbar.x.plus = NULL,
   errbar.x.minus = NULL, errbar.y.plus = NULL, errbar.y.minus = NULL,
   x.plus = NULL, x.minus = NULL, y.plus = NULL, y.minus = NULL,
   errbar.tick = 1/50, errbar.lwd = par("lwd"), errbar.lty = par("lty"),
   errbar.col = par("fg"), errbar.y.polygon = FALSE,
   errbar.y.polygon.list = list(NULL), add = FALSE)

It permits to plot errbar both on x and y.

Sincerely,

Marc Girondot

Le 19/07/2014 02:27, Ahmed Attia a écrit :
> My problem is getting x and y into the PlotCI. I do not know how to use the
> dput(). But below is my data;
>
>
>
> x  x-Water y  150 74.67 75  150 92.2 97  150 138.2 327.5  150 140.2 142.6
> 150 194.82 333.8  150 226.31 423  150 226.56 590.9  150 240.28 546.6  150
> 241.55 232.3  150 243.07 454.6  350 252.7 352.8  350 257.4 459.7  350 260.09
> 874.2  350 260.5 272.8  350 270.25 359.8  350 272.54 1008  350 286 638.9
> 350 288.3 791  350 288.54 736  350 291.34 816.3  350 297.0 465  350 303.8
> 234.3  350 306.58 601.9  350 310.38 942.9  350 311.3 334.4  350 317.75 522.1
> 350 330.45 563  350 333.78 717.4  350 339.59 851.5  350 341.37 642  350
> 342.7 490.5  350 344.2 487.7  350 344.42 1174  350 345.4 440.7  350 345.44
> 243  350 349.22 834.8  350 354.48 704.9  350 363.4 885  350 365.75 606.7
> 350 366.77 1036.9  350 370.08 898.8  350 371.09 640.9  350 372.69 768.1  350
> 374.24 574.4  350 375.15 200.9  350 375.3 1217  350 376.17 836.4  350 377.7
> 949.8  350 377.7 986.9  350 382.74 458.6  350 384 456.4  350 384.3 1189  350
> 385.9 978.2  350 388.44 379.7  350 391.66 865.7  350 392.44 1026.8  350
> 394.3 663.7  350 398.74 533.1  350 399.72 551.6  350 402.33 341.3  350 410.4
> 889  350 413 1530  350 419.35 1109.8  350 421.19 802.1  350 422.4 896.8  350
> 422.65 995.6  350 428.49 1337  350 433.72 1304.6  350 439.2 1190.4  350
> 439.42 914.3  350 440.43 1016.9  350 443 1266.1  350 446.4 659.3  350 448.05
> 369.3  550 455.34 1206.2  550 456.44 1139.9  550 458.45 1541.1  550 461.52
> 1048.4  550 461.77 486  550 462.45 910.6  550 467.49 1257  550 470.15 880.1
> 550 471.2 1155.7  550 471.32 1275  550 475.22 570.4  550 475.48 1226.6  550
> 481.58 1520  550 484.52 1549.6  550 488.29 1298  550 488.73 887.1  550
> 490.98 1261  550 491.08 1519.5  550 492.76 1082.6  550 499.38 1339.3  550
> 501.31 1121.3  550 503.42 1216.8  550 503.87 723.6  550 505.71 1488.6  550
> 506.74 1613.1  550 510.77 1460.9  550 514.09 1207.1  550 518.72 1167.771
> 550 519.93 1485.1  550 523.09 1025.8  550 526.79 986.5  550 530.34 874.5
> 550 532.89 1408.8  550 534.16 1197.7  550 538.1 1235.1  550 542.06 1219.7
> 550 545.34 1176.2  550 548.89 1366.4  550 550.668 1248  550 551.0 1434.4
> 550 551.84 1092.1  550 552.95 766.5  550 553.68 1465.7  550 556.76 1311.6
> 550 557.59 1247.3  550 558 1288.3  550 558.23 1115.257  550 567.66 1514.2
> 550 571.75 1249.9  550 571.82 1320  550 572.8 1397.2  550 577.89 1228  550
> 578 1580.1  550 578.5 1491.3  550 582.67 1304.3  550 587.75 1188.7  550
> 590.14 1476.8  550 592.07 1644.1  550 592.1 1334.4  550 596.9 1395.7  550
> 600.2 1468  550 602.76 978.3  550 604.01 1183.5  550 604.57 1051.49  550
> 608.98 1408.4  550 610.875 1189.9  550 616.45 1647.9  550 620.7 1193.3  550
> 623.58 1804  550 626.6 1575.8  550 629.16 1187.8  550 635.25 1468.2  550
> 638.34 1276  550 640.32 982.4  550 641 1241.3  550 647.5 1452.4  550 649.24
> 1826.5  750 653.56 1613.7  750 660.36 1731  750 665.22 1271.6  750 665.92
> 1172.369  750 669.03 1403.9  750 669.03 1261  750 669.94 1582.7  750 671.6
> 1296.4  750 673.35 1280.7  750 675.85 1306.8  750 678.43 1697.6  750 679.42
> 1435.1  750 679.48 1315.4  750 682.49 930.7  750 684.68 1612.1  750 685.29
> 1328.3  750 702.74 1111.3  750 704.58 980.6  750 712.97 1766.4  750 713.996
> 1163.7  750 714.4 1458  750 715.14 1238  750 717.14 1553.6  750 718.82
> 1653.9  750 720.55 1343.4  750 729.06 1053.063  750 730.754 1132  750 742.0
> 1293.2  750 755.87 1564.7  750 757.42 1211.7  750 764.03 1420.6  750 765.25
> 1449.4  750 766.08 1839  750 768.09 1579.1  750 769 1546.7  750 772.17
> 1779.6  750 772.41 1193.6  750 777.2 1880.7  750 783.62 1558.8  750 785.9
> 1259.4  750 788.64 1363.6  750 790.09 1398.4  750 793.22 1157.607  750
> 805.67 1135  750 808.99 1617.3  750 812.03 1246.4  750 820.672 1362  750
> 831.4 1586  750 842.51 1362.5  750 852.18 1597  950 852.18 1597  950 861.03
> 1554.4  950 865.26 1358.2  950 870.926 1713  950 872.74 1191.2  950 878.83
> 1544.1  950 895.62 1651.7  950 896.59 1233.2  950 901.22 1209.8  950 935.58
> 1278.7  950 944.11 1215.1  950 966.12 1334.8  950 991.9 1336.9  950 1025.16
> 1542.5  1150 1086.35 1382  1150 1142.5 1447.2  1150 1203.15 1262.4
> x is the x-axis and y is the y-axis. x-Water should be used to produce the
> horizontal error bars. How I can tell the program to do that.
>
> Thanks
>
> AA
>
>
> Ahmed M. Attia
>
>
> Research Assistant
> Dept. of Soil&Crop Sciences
> Texas A&M University
> ahmed.attia at ag.tamu.edu
> Cell phone: 001-979-248-5215
> FAX: 001-308-455-4024
>
>
>
> On Fri, Jul 18, 2014 at 3:30 PM, William Dunlap <wdunlap at tibco.com> wrote:
>
>> Is the original poster having trouble translating the synopsis at the
>> top of the help file to actual code?  He should look at the examples
>> at the bottom of the help file, or better, run them with
>>     example(plotCI)
>> and see if any of the plots looks close to what he wants.
>>
>>
>>
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
>>
>>
>> On Fri, Jul 18, 2014 at 3:15 PM, Sarah Goslee <sarah.goslee at gmail.com>
>> wrote:
>>> The example given in ?plotCI works just fine for me. You'll need to be
>>> more specific about what isn't working, and ideally provide some data
>>> with dput().
>>> Notice the add=TRUE argument in the second call to plotCI().
>>>
>>>
>>>        y<-runif(10)
>>>        err.x<-runif(10)
>>>        err.y<-runif(10)
>>>        plotCI(1:10,y,err.y,pt.bg=par("bg"),pch=21,xlim=c(0,11),
>>> main="plotCI with extra space on the x axis")
>>>        plotCI(1:10,y,err.x,pt.bg=par("bg"),pch=21,err="x",add=TRUE)
>>>
>>> Sarah
>>>
>>> On Fri, Jul 18, 2014 at 6:06 PM, Ahmed Attia <ahmedatia80 at gmail.com>
>> wrote:
>>>> Hi all,
>>>>
>>>> I have been also trying the plotCI but it did not work out
>>>>
>>>> plotCI(x, y = NULL, uiw, liw = uiw, ui, li, err='y', ylim=NULL,
>>>>         xlim=NULL, type="p",  col=par("col"), barcol=col,
>>>>         pt.bg = par("bg"),  sfrac = 0.01, gap=1, lwd=par("lwd"),
>>>>         lty=par("lty"), labels=FALSE, add=FALSE, xlab, ylab,  minbar,
>>>>         maxbar, ... )
>>>>
>>>>
>>>> I searched and looked at the previous plotCI posts below;
>>>>
>>>>
>>>>
>>>>
>> http://www.talkstats.com/showthread.php/51908-Vertical-and-horizontal-error-bars-PlotCI-errbar
>>>>
>>>> Dear R users,
>>>>
>>>> I would appreciate your help in plotting the means with simultaneous
>>>> horizontal and vertical error bars. I use the lineplot.CI but it creates
>>>> the vertical bars only.
>>>>
>>>>
>>>> The attached file has the dataset that I want to graph. The (X) is the
>>>> x-axis values and (y Lint) is the response in y-axis. Therefore, values
>> in
>>>> the x-axis would be 150, 350, 550, .....etc.
>>>>
>>>> At each value of the x-axis would be the average response point (y Lint)
>>>> with vertical and horizontal error bars.
>>>>
>>>> Each value of the x-axis (X) represents a range of values that in x
>> Water.
>>>> The x Water column should be used to draw the horizontal lines.
>>>>
>>>> Thank you so much.
>>>>
>>>> AA
>>>>
>>>>
>>>>
>>>>
>>>> Ahmed M. Attia
>>>>
>>>>
>>> ______________________________________________
>>> 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.
> 	[[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