有谁知道如何删除条形码下面的文字?条形码是使用barcode.py
库生成的。我试图检查https://bitbucket.org/whitie/python-barcode 但找不到解决方案,应该在 python 中的条形码保存行中写入哪些属性:
ean = barcode.get('code39', str(row['PART']), writer=ImageWriter())
Run Code Online (Sandbox Code Playgroud)
对在图表上显示实际值有疑问。我确实有一张印刷图表,需要显示每个堆叠条形图的值。如何显示这些值?
我已经尝试过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)