1 year ago

#319231

test-img

Aimas

Matplotlib error bar not placed correctly

I have the following variables:

     m = array(['2016-02-03T06:35:00.000000000', '2016-03- 07T12:09:00.000000000',
   '2016-04-05T07:57:00.000000000', '2016-05-03T10:29:00.000000000',
   '2016-05-30T19:23:00.000000000', '2016-08-11T05:03:00.000000000',
   '2016-09-06T04:27:00.000000000'], dtype='datetime64[ns]')

   n = array([9.60257044e+05, 2.73061146e+05, 6.30219177e+04, 2.18310433e+07,
   1.25728987e+04, 1.21189090e+05, 1.20494747e+06])
   o = array([1.10110070e+06, 3.19370657e+05, 4.99755918e+04, 3.26636779e+07,
   1.89902834e+04, 1.16384062e+05, 1.07328724e+06])

while trying to plot error bar in matplotlib using the following code:

    plt.scatter (m, n)
    plt.errorbar (m, n, yerr = o)

the errorbar is plotted in the horizontal axis not on the vertical axis. What may be the possible reasons behind this and how to overcome this? The plot is shown belowenter image description here

python

dataframe

matplotlib

errorbar

0 Answers

Your Answer

Accepted video resources