Matplotlib 错误栏放置不正确

发布于 2025-01-16 07:52:34 字数 887 浏览 0 评论 0原文

我有以下变量:

     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])

在尝试使用以下代码在 matplotlib 中绘制误差条时:

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

误差条绘制在水平轴而不是垂直轴上。这背后可能的原因是什么以及如何克服这个问题? 该图如下所示在此处输入图像描述

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文