Message Boards Message Boards

Unable to plot dataset with ErrorListPlot and Style

POSTED BY: audun bersaas
2 Replies

It's very helpful to break your code down and provide a minimal example of the problem. If a plot isn't working, then look at how the plotting function is being called in a specific case. We'll use variable1 of dataset2. In this case, take a look at the code given to ErrorListPlot:

ErrorListPlot[
    {Style[{{1., 1}, ErrorBar[{-0.14939999999999998, 0.17559999999999998}, 0]}], 
     Style[{{1., 2}, ErrorBar[{-0.6915, 2.2415}, 0]}], 
     Style[{{1., 3}, ErrorBar[{-0.3349, 0.5034000000000001}, 0]}], 
     Style[{{1., 4}, ErrorBar[{-0.5853999999999999, 1.412}, 0]}], 
     Style[{{1., 5}, ErrorBar[{-0.23199999999999998, 0.30200000000000005}, 0]}], 
     Style[{{1., 6}, ErrorBar[{-0.34840000000000004, 0.5347999999999999}, 0]}]}
]

Your data is wrapped in Style. Style doesn't seem to be doing anything. If you get rid of it, ErrorListPlot works fine.

Replace

Style[{{#, #2}, ErrorBar[{-(# - #3), (#4 - #)}, 0]}]

With

{{#, #2}, ErrorBar[{-(# - #3), (#4 - #)}, 0]}

The documentation for ErrorListPlot doesn't show that it accepts input wrapped in Style. It seems to work fine with three inputs and break with six. The fact that it worked with three inputs appears to be a "lucky" fluke. In general you can't use Style with this function.

POSTED BY: Sean Clarke

Thank you for your help! That solves my problem.

POSTED BY: audun bersaas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract