# Plotting multiple datasets with ErrorListPlot

What is the equivalent of the code shown below using ErrorListPlot? Obviously, I will need to specify error bars, but is ErrorListPlot capable of plotting multiple datasets, as is possible with ListPlot, ListLinePlot and Plot?

data1 = {{1, 1}, {2, 2}, {3, 3}, {4, 4}};
data2 = {{1, 1}, {2, 3}, {3, 6}, {4, 12}};
data3 = {{1, 1}, {2, 4}, {3, 8}, {4, 16}};
ListPlot[{data1, data2, data3}]

• – user9660 Sep 19 '16 at 10:27

ErrorListPlot can indeed be used to plot multiple datasets using the usual format for plotting:

ErrorListPlot[{dataset1,dataset2,dataset3}]


First, be sure to load the package

Needs["ErrorBarPlots"]


Let's generate some error bars to go with your example dataset

errorlist1 = Table[RandomReal[{0, 2}], {Length[data1]}];
errorlist2 = Table[RandomReal[{0, 2}], {Length[data2]}];
errorlist3 = Table[RandomReal[{0, 2}], {Length[data3]}];


When plotting with explicit {x,y} coordinates, the syntax is {{{x1,y1},ErrorBar[value1]},...} for each point of the plot. For convenience, here's a function that takes the dataset and the list of errors as arguments:

datawitherror[data_, errorlist_] :=
Table[{data[[i]], ErrorBar[errorlist[[i]]]},
{i, 1, Length[data]}];


And finally the plotting

ErrorListPlot[{datawitherror[data1, errorlist1],
datawitherror[data2, errorlist2], datawitherror[data3, errorlist3]}]
`