1
$\begingroup$

I made a few months ago the following list

data={{{1, -1.21}, ErrorBar[{-0.26, 0.279}]}, {{2, -1.22},
ErrorBar[{-0.267, 0.282}]}, {{3, -1.255},ErrorBar[{-0.263, 0.278}]}, {{4, -1.317},
ErrorBar[{-0.263, 0.278}]}, {{5, -1.2109},ErrorBar[{-0.2612, 0.275}]}} 

and I want to have these points in ErrorListPLot howevere instead of x axis with 1,2,3,etc i want to have years from 2006 up to 2010 but i am not quite sure how to do it because of the ErroBar as the third element of the list. Any suggestions?

$\endgroup$
1
  • 1
    $\begingroup$ I suggest you look at the package ErrorBarPlots... $\endgroup$ Feb 22, 2018 at 10:17

1 Answer 1

1
$\begingroup$
              data = {{{1, -1.21}, ErrorBar[{-0.26, 0.279}]}, {{2, -1.22}, 
    ErrorBar[{-0.267, 0.282}]}, {{3, -1.255}, 
    ErrorBar[{-0.263, 0.278}]}, {{4, -1.317}, 
   ErrorBar[{-0.263, 0.278}]}, {{5, -1.2109}, 
   ErrorBar[{-0.2612, 0.275}]}};
   d1 = First /@ data; d4 = Table[i, {i, 2006, 2010, 1}]
   d6 = Last /@ data; d5 = Last /@ d1
   d7 = Transpose[{d4, d5}]; d8 = Transpose[{d7, d6}]
   ErrorListPlot[d8, PlotRange -> {All, {-2, 0}}, Frame -> True, 
    PlotStyle -> Blue]

plot of data

$\endgroup$
1
  • $\begingroup$ Thanks a lot! It is works great $\endgroup$
    – Smaug
    Feb 22, 2018 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.