0

I know I need to use ErrorListPlot and a list with elements of the form {{x,y},ErrorBar[e]}. I have x,y,and e all as lists, but I can't figure out how to get a list of of the form...

{ErrorBar[e1],ErrorBar[e2],...,ErrorBar[en]}

... which I'd Riffle together with the list Transpose[{x,y}]. I thought maybe Table[ErrorBar[e[[i]]],{i,1,n}] but I can't use the argument of Part in Table this way.

This should be simple. Maybe I've got some fundamental misunderstanding on plots with error bars?

Jim Napolitano
  • 101
  • 1
  • 1
  • 2
  • Do you have defined a list e? If this is the case, there is no issue with doing Table[ErrorBar[e[[i]]],{i,1,n}] as long as n has a value (here Length[x] for instance). You could do as well e /@ Range[n]. –  Sep 17 '16 at 21:01
  • Thanks. I just tried this, and sure enough, it works. I could have sworn I tried it yesterday and it didn't. Must have been some kind of brain cramp.I ended up solving my problem using Map, but I'll go back to the simpler answer. – Jim Napolitano Sep 19 '16 at 01:07

1 Answers1

3

Define some data

x = N[Sqrt[Range[100]]];
y = Sin[2 Pi x / 10];
e = 1/x;

Produce the plot

Needs["ErrorBarPlots`"]
ErrorListPlot[MapThread[{{#1, #2}, ErrorBar[#3]} &, {x, y, e}]]

enter image description here

mikado
  • 16,741
  • 2
  • 20
  • 54