Two-dimensional error bars with ErrorPlotList in Mathematica?

977 views Asked by At

I am brand new to Mathematica and am having trouble putting two-dimensional error bars on a graph. I have a table with the data format: (r, sr, x, sx, y, sy) where r, x, and y are means and sr, sx, and sy are the standard deviations. I want to plot the x versus y columns and did this successfully with ListPlot:

Show[
 ListPlot[meanlist[[All, {3, 5}]]], Graphics[Circle[{0, 0}, 20]], 
 PlotRange -> All, AspectRatio -> 1, 
 AxesLabel -> {Style["y [mm]", Bold, Medium], 
   Style["z [mm]", Bold, Medium]},
 AxesOrigin -> {0, 0}]

If really necessary, I could leave it at that. However, I also want to add the x and y error bars. I tried doing this using ErrorListPlot:

ErrorListPlot[{{meanlist[[All, {3, 5}]]}, 
  ErrorBar[meanlist[[All, {4, 6}]]]}, 
 PlotRange -> All, AspectRatio -> 1, 
 AxesLabel -> {Style["y [mm]", Bold, Medium], 
   Style["z [mm]", Bold, Medium]},
 AxesOrigin -> {0, 0},
 ErrorBarFunction -> Automatic]

What I get out is the following (I truncated the two lists after the first line because they are long):

ErrorListPlot[{{{{-5.34473, -9.16194}, {-7.87379, -6.57843},...,
ErrorBar[{{0.501015, 0.72511}, {0.48202, 0.703881},...,
 AxesLabel -> {Style["y [mm]", Bold, Medium], 
   Style["z [mm]", Bold, Medium]},
 AxesOrigin -> {0, 0},
 ErrorBarFunction -> Automatic]

In other words, it spits out lists of properly paired coordinates and error amounts followed by all the parameters I set for the graph, but it does not actually create a plot. I have included Needs["ErrorBarPlots`"]; and I'm no sure what else could be wrong. Any ideas?

1

There are 1 answers

0
agentp On

try this:

 ErrorListPlot[
      {#[[{3, 5}]], ErrorBar[#[[4]], #[[6]]] } & /@ meanlist ] 

Aside, The final result you saw is typical of mathematica when you supply a function with invalid arguments, it repeats back what you entered rather than reporting an error.