Message Boards Message Boards

0
|
2742 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

[?] Plot error bars on three vectors of data?

Posted 5 years ago

Hello everyone. I have three vectors of data, the first one is the propper information, the other ones are the error in both X and Y axis. I want to plot them as in this example: https://reference.wolfram.com/language/ErrorBarPlots/ref/ErrorBar.html; however, the information here has been introduced manually. Is there a way to program this to be read from three vectors for the error on both axis plus the obtained values?

I have tried with this, but it does not work:

g1 = ErrorListPlot[{meanx1, meanx2}, ErrorBar[stdx1, stdx2]]

Aditionally I adjoint an image of an attempt I have made to plot this data in case it can help.

Thanks for readingenter image description here.

POSTED BY: Jaime de la Mota
3 Replies

Thank you very much Neil. It works perfectly.

POSTED BY: Jaime de la Mota

or if you have different positive and negative errors:

data = MapThread[{{#1, #2}, ErrorBar[#3, #4]} &, {times, vals, errors,
    errors2}]
POSTED BY: Neil Singer

Jaime,

Use MapThread to construct your list of data in the right format:

data = MapThread[{{#1, #2}, ErrorBar[#3]} &, {times, vals, errors}]

Then Plot with

ErrorListPlot[data]

Note that ErrorListPlot is no longer supported in Version 12 (when released) and the functionality will be built into ListPlot.

Regards,

Neil

POSTED BY: Neil Singer
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