1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/nanxun-pythonshujukeshihuajiantu

Клонировать/Скачать
条形图.py 432 Байты
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
nanxun Отправлено 05.06.2017 17:17 4f3a179
import matplotlib.pyplot as plt
import numpy as np
N=5
y=[20,10,30,25,15]
y1=np.random.randint(10,50,5)
x=np.random.randint(10,1000,N)
index=np.arange(N)
# plt.bar(left=index,height=y,color='red',width=0.3)
# plt.bar(left=index+0.3,height=y1,color='black',width=0.3)
#plt.barh() 加了h就是横向的条形图,不用设置orientation
plt.bar(left=0,bottom=index,width=y,color='red',height=0.5,orientation='horizontal')
plt.show()

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/nanxun-pythonshujukeshihuajiantu.git
git@api.gitlife.ru:oschina-mirror/nanxun-pythonshujukeshihuajiantu.git
oschina-mirror
nanxun-pythonshujukeshihuajiantu
nanxun-pythonshujukeshihuajiantu
master