2
$\begingroup$

I have data sets form measurements with standard deviations

    time = {1, 2, 3, 4, 5}
    data = {1, 4, 9, 16, 25}
    error = {.2, 0.5, 0.8, 1.2, 1.9}

which I would like to visualise using ListPlot with uncertainties option (new in Mathematica12). For that I need to create a list such as

    {1±0.2±0.5,..., 25±1.9}

Any suggestions how to do that? creating list by hand and plotting it works fine, but that can't be the solution for some 100+ data points... Or, what is the easiest way to make a plot with standard deviations when measurement data are organised in three separate list, i.e. x, y, error.

Thanks Holger

$\endgroup$
7
$\begingroup$

Use MapThread to combine all three lists together.

dataWithError = MapThread[{#1, Around[#2, #3]} &, {time, data, error}];
ListPlot[dataWithError];

Mathematica graphics

$\endgroup$
3
  • $\begingroup$ +1 Also ListPlot[{#[[1]], Around[#[[2]], #[[3]]]} & /@ Transpose[{time, data, error}]] $\endgroup$
    – Bob Hanlon
    Aug 1 at 14:45
  • $\begingroup$ great, works! Thanks so much, I replay appreciate it! $\endgroup$
    – Holger
    Aug 1 at 15:46
  • $\begingroup$ @Holger, great! If you find the answer valuable, consider accepting it (by clicking on the green tick). $\endgroup$
    – Domen
    Aug 1 at 16:45

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