小编ora*_*gas的帖子

删除 python Barcode.py 库中条形码下方的文本

有谁知道如何删除条形码下面的文字?条形码是使用barcode.py库生成的。我试图检查https://bitbucket.org/whitie/python-barcode 但找不到解决方案,应该在 python 中的条形码保存行中写入哪些属性:

ean = barcode.get('code39', str(row['PART']), writer=ImageWriter())
Run Code Online (Sandbox Code Playgroud)

附上带有标记线的条形码图片,我想从条形码生成中删除这些内容。 在此输入图像描述

python barcode python-2.7

3
推荐指数
2
解决办法
5542
查看次数

使用matplotlib在每个堆叠条上的Y值

对在图表上显示实际值有疑问。我确实有一张印刷图表,需要显示每个堆叠条形图的值。如何显示这些值?

我已经尝试过ax.text功能,但是无法给出预期的结果(如图所示)。由于图表已标准化为1,因此我需要显示每个堆叠条形的实际值(顶部是总数,应将其拆分为每个条形,第一个条形应该有1个数字7,第二个条形应该有3个数字,其中数字41(按每个颜色条的大小划分)。是否有可能做到这一点?

我的代码如何提出多个堆叠的条形图:

def autolabel(rects):
    # attach some text labels
    for rect in rects:
        height = rect.get_height()
        ax.text(rect.get_x()+rect.get_width()/2., 1.05*height, '%d'%int(height),
                ha='center', va='bottom')

p = [] # list of bar properties
def create_subplot(matrix, colors, axis):
    bar_renderers = []
    ind = np.arange(matrix.shape[1])
    bottoms = np.cumsum(np.vstack((np.zeros(matrix.shape[1]), matrix)), axis=0)[:-1]
    for i, row in enumerate(matrix):
        print bottoms[i]
        r = axis.bar(ind, row, width=0.5, color=colors[i], bottom=bottoms[i])
        bar_renderers.append(r)
        autolabel(r)
    #axis.set_title(title,fontsize=28)
    return bar_renderers

p.extend(create_subplot(nauja_matrica,spalvos, ax))
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

python charts matplotlib stacked-chart

1
推荐指数
1
解决办法
1675
查看次数

标签 统计

python ×2

barcode ×1

charts ×1

matplotlib ×1

python-2.7 ×1

stacked-chart ×1