【问题标题】:Pyplot - How can I plot in needle/histogram style?Pyplot - 如何以针/直方图样式绘制?
【发布时间】:2014-04-17 05:39:55
【问题描述】:

我想用针符号绘制一个图,就像在 R 中一样:

x = 1:10
y = rnorm(10)
plot(x,y,type ='h')

有谁知道如何在 Python 中绘制这样的图形?不是直方图,只是用针符号表示的 x-y 图..

>>> jan_avg
Jan+0    139.833333
Feb+0    158.318182
Mar+0    149.500000
Apr+0    106.750000
May+0    104.477273
Jun+0    105.159091
Jul+0     56.295455
Aug+0     56.295455
Sep+0     56.295455
Oct+0     53.659091
Nov+0     53.659091
Dec+0     53.659091

这里的第一列是数据框 jan_avg 的索引,将是我的 x 轴..

>>> jan_avg.plot() # What choices should I specify here?

【问题讨论】:

    标签: python r matplotlib histogram


    【解决方案1】:

    我想我明白了:

    jan_avg.plot(kind = 'bar')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-23
      • 1970-01-01
      • 1970-01-01
      • 2018-07-23
      • 1970-01-01
      • 2015-08-26
      • 2021-03-25
      • 2021-04-12
      相关资源
      最近更新 更多