小编Per*_*inn的帖子

使用 rotation='vertical' 的垂直条形图不起作用

从 matplot lib 示例中,lines_bars_and_markers 使用rotation='vertical'不会使其垂直。我究竟做错了什么?

"""
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.show()
rotation='vertical'
Run Code Online (Sandbox Code Playgroud)

python numpy matplotlib

2
推荐指数
1
解决办法
7176
查看次数

标签 统计

matplotlib ×1

numpy ×1

python ×1