Pyplot - 如何以针状/直方图样式绘图?
我想用一个针状符号来制作一个图,就像在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?
1 个回答
0
我想我明白了:
jan_avg.plot(kind = 'bar')