最佳答案
要使用matplotlib.pyplot.hist
显示反向直方图,可以使用参数weigths
对值赋予负权重。
最小示例:
import numpy as np
import matplotlib.pyplot as plt
x1 = np.random.random(100)
x2 = np.random.random(100)
plt.hist(x1, facecolor='teal', edgecolor='white', range=(0, 1))
plt.hist(x2, fc='tomato', ec='white', weights=np.full(len(x2), -1), range=(0, 1))
plt.show()
关于python-3.x - 是否可以使用 Matplotlib 创建 2 边条形图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61559131/