# Including error bars on graph in Mathematica [duplicate]

This question already has an answer here:

Mathematica ListPlot function allows me to plot the above data with omega on the x-axis and CD on the y-axis

1) How do I incorporate the error bars in my data on the graph? 2) Are there any basis statistical analysis I could possibly extract from my exists data table?

## marked as duplicate by Karsten 7., Sjoerd C. de Vries, Bob Hanlon, Öskå, ciaoMar 17 '15 at 22:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• Try Needs["ErrorBarPlots"] – Jinxed Mar 17 '15 at 13:45
• Look up "error bars" on this site and in Mathematica's documentation. Many hits. – Sjoerd C. de Vries Mar 17 '15 at 18:34

## 1 Answer

MyData = {{0.5, 0.476}, {0.8, 0.55}, {1.15, 0.703}, {1.3, 0.733}};
error = {0.009, 0.03, 0.003, 0.015};
withError = Transpose[{MyData[[All, 1]], MyData[[All, 2]], error}]


{{0.5, 0.476, 0.009}, {0.8, 0.55, 0.03}, {1.15, 0.703, 0.003}, {1.3, 0.733, 0.015}}

Needs["ErrorBarPlots"]
Show[ListPlot[MyData], Plot[lm[x], {x, 0, 5}],ErrorListPlot[withError,
PlotStyle -> Red]]


See also: ErrorListPlot

• Hi Lou, It is strange that when I plot using your codes, the best-fit line is not showing. – boyinneed Mar 18 '15 at 6:54
• @boyinneed, do you execute the linear Model fit? – user9660 Mar 18 '15 at 8:55
• Yes I do. Thank you (: – boyinneed Mar 18 '15 at 12:21