我正在尝试使用python matplotlib制作条形图。我的图表必须是这样的:
但我无法绘制包含子条的栏。有谁知道如何做到这一点?提前致谢
这是一个小例子,它在条形图中绘制条形图:
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)
我不认为,这是你的实际问题。你究竟需要什么?