使用 matplotlib 在条内打印条 python

Print bar inside bar with mathplotlib python

我正在尝试使用 python mathplotlib 制作条形图。 我的图表必须是这样的:

但是我无法绘制包含子条的条。 有谁知道如何做到这一点? 提前致谢

这是一个小例子,它在条内绘制条:

import matplotlib.pyplot as plt

y1 = [1, 2]
x1 = [1, 3]

y2 = [0.5, 0.7, 0.6, 0.9]
x2 = [0.7, 1.3, 2.7, 3.3]

plt.bar(x1, y1, width=1.5)
plt.bar(x2, y2, width=0.5)

我不认为这是您的实际问题。您究竟需要什么?