Python和Matplotlib中的竖直直方图 在Python和Matplotlib中绘制竖直直方图,我们可以按照以下步骤进行 − 设置图形大小并调整子图之间和周围的间距。 创建一个数据点列表。 画一张竖直方向的直方图。 使用 show() 方法来显示图像。 示例 import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = [1, 2, 3, 1, 2, 3, 4, 1, 3, 4, 5] plt.hist(x, orientation="vertical") plt.show() PythonCopy 输出