最简单的柱状代码应该是这样的# coding: utf-8import matplotlib.pyplot as pltimport numpy as npx = np.random.randint(0, 10, size=10)y = np.random.randint(100, 1000, size=10)plt.bar(x, y)plt.show()
加一句plt.xticks(x)