【问题标题】:Print bar inside bar with mathplotlib python使用matplotlib python打印栏内栏
【发布时间】:2019-02-24 17:29:04
【问题描述】:

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

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

【问题讨论】:

  • 到目前为止你做了什么?
  • 我试图在子栏上绘制主栏,但它们移动了整个图案。

标签: python charts bar-chart sample


【解决方案1】:

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

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)

我不认为这是您的实际问题。你到底需要什么?

【讨论】:

    猜你喜欢
    • 2011-03-01
    • 2011-02-19
    • 2020-07-16
    • 1970-01-01
    • 2014-10-19
    • 1970-01-01
    • 1970-01-01
    • 2018-08-24
    • 2014-08-01
    相关资源
    最近更新 更多