
barh.jpg
\"\"\"
Simple demo of a horizontal bar chart.
\"\"\"
import matplotlib.pyplot as plt
plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt
# Example data
people = (\'Tom\', \'Dick\', \'Harry\', \'Slim\', \'Jim\')
y_pos = np.arange(len(people))
performance = 3 + 10 * np.random.rand(len(people))
error = np.random.rand(len(people))
plt.barh(y_pos, performance, xerr=error, align=\'center\', alpha=0.4)
plt.yticks(y_pos, people)
plt.xlabel(\'Performance\')
plt.title(\'How fast do you want to go today?\')
plt.savefig(\"barh.eps\",format=\"eps\")
plt.rcdefaults()
恢复 rc 的默认设置
barh()
主要功能:做一个横向条形图,横向条的矩形大小为: left, left + width, bottom, bottom + height
参数:barh ( bottom , width , height =0.8, left =0, ** kwargs )
返回类型:一个 class 类别,matplotlib.patches.Rectangle实例
参数说明:
可选参数:
更多文章可以访问我的个人博客
上一篇:python爬虫(一)