我可以给你一些参考代码:import matplotlib.pyplot as plt import numpy as npdef draw_shannon_entropy(p, title): x = np.arange(len(p)) plt.bar(x, p, width=0.5, color=’g’) plt.xlabel(‘X’) plt.ylabel(‘Probability’) plt.title(title) plt.show()p = [0.2, 0.2, 0.2, 0.2, 0.2] draw_shannon_entropy