Re: Error bars
- To: mathgroup at smc.vnet.net
- Subject: [mg118645] Re: Error bars
- From: "Judy Price" <jprice29 at tsrlinc.net>
- Date: Thu, 5 May 2011 05:26:09 -0400 (EDT)
Thanks, Robert, for the code. When I sent the data, I had forgotten to transpose a matrix, so my means are off. -----Original Message----- From: Robert Rosenbaum [mailto:robertr at math.uh.edu] Sent: Thursday, May 05, 2011 12:51 AM To: Judy Price Cc: mathgroup at smc.vnet.net Subject: [mg118645] Re: [mg118574] Error bars It's not the neatest solution and you'll need to tweak the aesthetics if you want to use it for a publication (see esp. ErrorBarFunction), but the code below should get you started. BTW, the data you sent looks to be a bit off: there are a different number of means than intervals and the means do not all lie in their respective intervals. Here's the code: Needs["ErrorBarPlots`"] means = {79.2834, 74.4719, 73.8007, 73.5467, 72.2965, 76.136, 75.1637, 74.341, 75.7873, 75.997, 73.6585, 75.1196, 76.3168, 73.8244, 75.4527, 76.4404, 75.0104, 76.5596, 76.2118, 75.8198}; (*,72.9094,75.9392,77.5203,73.8933};*) intervals = {{71.5152, 75.6588}, {71.1603, 75.3777}, {72.2091, 76.9714}, {72.4496, 77.0188}, {74.7051, 78.4491}, {72.1719, 76.8556}, {72.2981, 77.7783}, {72.5936, 76.9063}, {74.3673, 78.4631}, {73.9854, 78.8609}, {74.6407, 77.7396}, {73.9558, 77.9133}, {72.2582, 76.3498}, {73.2699, 78.5874}, {71.4071, 77.1258}, {75.7951, 80.7734}, {74.3078, 78.3051}, {71.2209, 76.5365}, {70.7587, 76.3733}, {73.8667, 78.1864}}; errs = intervals - means; n = Length[means]; Show[{ BarChart[means, BarSpacing -> None], ErrorListPlot[ Table[{{i - 1/2, means[[i]]}, ErrorBar[errs[[i]]]}, {i, 1, n}], PlotStyle -> {Thick, PointSize[.02]}] }]