【问题标题】:add text in bins of histogram in wxpython在 wxpython 的直方图箱中添加文本
【发布时间】:2014-03-05 05:40:40
【问题描述】:

如何在 wxpython 的直方图的 bins(bars) 中写入文本?

    import csv
    import matplotlib
    import matplotlib.pyplot as plt
    import numpy as np
    from matplotlib.figure import Figure
    data1 = np.random.normal(5.0,3.0,1000)
    with open('test.csv', 'wb') as f:
    writer = csv.writer(f)



    plt.hist(data1)
    plt.show()

【问题讨论】:

    标签: python-2.7 numpy matplotlib wxpython


    【解决方案1】:

    您不能直接在垃圾箱内写入文本。这是因为 bin 是简单的 Pactch 对象。
    但是,不要绝望!您可以通过一条途径来实现这一目标:

    • 遍历 bin,获取它们的边界
    • 创建文本标签
    • 将其放置在正确的边界内

    要获得 bin 边界,请在此处查看我的答案:How to color bars who make up 50% of the data?

    【讨论】:

    • 先生,使用标签我将如何在垃圾箱中写垂直文本??
    猜你喜欢
    • 2016-06-23
    • 2021-10-29
    • 1970-01-01
    • 1970-01-01
    • 2014-02-21
    • 2020-03-06
    • 1970-01-01
    • 1970-01-01
    • 2011-07-23
    相关资源
    最近更新 更多