2
$\begingroup$

I have a following problem:

I am performing error analysis for my data set using multiple technics. Obviously, at the end of my analysis I want to compare the errorbars plotting them on the same graph. However, the best I have got for now is

enter image description here

I really need it to be on one plot and both vertical=( Can Mathematica do that?

$\endgroup$
2
  • 1
    $\begingroup$ Would you mind posting your entire code instead of a screenshot? Also, I am not quite sure what it is that you want as an end result $\endgroup$
    – Julian
    Oct 8, 2015 at 18:52
  • 1
    $\begingroup$ Your question is a bit unclear. You say you want to display multiple error bars and your picture just shows that. And you want it both vertical ... and what? $\endgroup$ Oct 8, 2015 at 18:55

1 Answer 1

6
$\begingroup$

one idea..

Needs["ErrorBarPlots`"]
Show[{ErrorListPlot[
   Table[ {{x, Sin[x]}, 
     ErrorBar[RandomVariate[NormalDistribution[.3, .1]], 
      RandomVariate[NormalDistribution[.1, .1]]]} , {x, 0, 2 Pi, .2}],
    ErrorBarFunction -> 
    Function[{coords, errs}, {Opacity[0.2], 
      Rectangle[coords + {errs[[1, 1]], errs[[2, 1]]}, 
       coords + {errs[[1, 2]], errs[[2, 2]]}]}]],
  ErrorListPlot[
   Table[ {{x, Sin[x]}, 
     ErrorBar[RandomVariate[NormalDistribution[.3, .1]], 
      RandomVariate[NormalDistribution[.1, .1]]]} , {x, 0, 
     2 Pi, .3}]]}, PlotRange -> All]

enter image description here

Here is an example drawing lines slightly offset:

Needs["ErrorBarPlots`"]
offseterror[off_, color_][coords_, errs_] := {color, 
  Line[{off, 0} + coords + # & /@ Transpose[List @@ errs]]}
Show[{
  ErrorListPlot[Table[{{x, Sin[x]},
     ErrorBar[RandomVariate[NormalDistribution[.3, .1]]]}, {x, 0, 
     2 Pi, .3}], ErrorBarFunction -> offseterror[0, Blue]],
  ErrorListPlot[Table[{{x, Sin[x]},
     ErrorBar[RandomVariate[NormalDistribution[.2, .1]]]}, {x, 0, 
     2 Pi, .3}], ErrorBarFunction -> offseterror[0.04, Red]]}, 
 PlotRange -> All]

enter image description here

It should be clear how to add the little end bars if you want. I figure it would get too cluttered and you are better off without anyway though.

$\endgroup$
2
  • $\begingroup$ Yep, thanks, but that's the same syntax I have used... $\endgroup$
    – MsTais
    Oct 12, 2015 at 21:45
  • $\begingroup$ Perfect! Thanks=) $\endgroup$
    – MsTais
    Oct 15, 2015 at 2:32

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.