Mathematica Asked by user8357568 on February 8, 2021
I have 2 sets of data imported from excel file, Let say
A = 20
21
22
…
30A
B= 0
1
2
3
…
10
I want to plot A with a relative error of 10%
errordataA= Around[A,Scaled[.1]]
But output was "Around[A, Scaled[0.1]]" not "Around[2+-10%]".
Then I want to create a plot with B.
ListPlot[
{A,
B
}
IntervalMarkers -> "Bands",
Sequence[PlotTheme -> "Scientific",
PlotRangePadding -> {Automatic, Scaled[0.15]}]
]
Since the code can’t read set A data so the graph does not show.
How can I fix this one?
The Around
expression you mention seems to work fine for me:
a = Around[Range[20, 30], Scaled[0.1]]
(* Out: {Around[20., 2.], Around[21., 2.1], Around[22., 2.2],
Around[23., 2.3], Around[24., 2.4], Around[25., 2.5],
Around[26., 2.6], Around[27., 2.7],
Around[28., 2.8], Around[29., 2.9],
Around[30., 3.]} *)
From there, I think you might want to plot a
vs. b
, i.e. the a values as ordinates and the values as abscissae. If that's what you want, then that works too, but you will want to Transpose
the {b, a}
set of data:
a = Around[Range[20, 30], Scaled[0.1]]
b = Range[0, 10]
ListPlot[
Transpose@{b, a},
IntervalMarkers -> "Bands",
PlotTheme -> "Scientific",
PlotRangePadding -> {Automatic, Scaled[0.15]}
]
—-
An alternative interpretation after OP’s comments:
ListPlot[
{a, b},
IntervalMarkers -> "Bands",
PlotTheme -> "Scientific",
PlotRangePadding -> {Automatic, Scaled[0.15]}
]
Answered by MarcoB on February 8, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP