前面的设置中文字体,发现不能在heroku上使用
这边我用matplotlib.font_manager 的 FontProperties直接使用指定路径的字体来代替
fontname='font/Arial Unicode MS.ttf'
for key, cell in tab.get_celld().items():
row, col = key
if row >= 0 and col >= 0:
cell.set_text_props(fontproperties=FontProperties(fname=fontname))
修改後
if(event.message.text[:3:]=="团购" and rights[2]): #view right
cursor = conn.cursor()
cursor.execute(f"SELECT keyword,name,quantity FROM group_buying_user NATURAL JOIN group_buying_message order by keyword;")
users = cursor.fetchall()
cursor.close()
fig, ax =plt.subplots(1,1)
data=[]
color=[]
color_list = ["#89C6C6","#A889C6","#C68989","#A8C689","#C07BC0","#C6C689"]
category=''
i=0
column_labels=['keyword','name','quantity']
for user in users:
if not category==user[0]:
if i==len(color_list)-1:
i=0
else:
i=i+1
color.append([color_list[i],color_list[i],color_list[i]])
category=user[0]
data.append([user[0],user[1],user[2]])
ax.axis('tight')
ax.axis('off')
tab=ax.table(cellText=data,colColours=["#DDDDDD"]*3,cellColours=color,colLabels=column_labels,cellLoc='center',loc="center")
fontname='font/Arial Unicode MS.ttf'
for key, cell in tab.get_celld().items():
row, col = key
if row >= 0 and col >= 0:
cell.set_text_props(fontproperties=FontProperties(fname=fontname))
plt.savefig('img/table.png',dpi=200)
CLIENT_ID='ceda715b6015fcb'
PATH = "img/table.png"
im = pyimgur.Imgur(CLIENT_ID)
uploaded_image = im.upload_image(PATH, title="iThome-2021")
print(uploaded_image.link)
message = ImageSendMessage(
original_content_url=uploaded_image.link,
preview_image_url=uploaded_image.link
)
line_bot_api.reply_message(event.reply_token,message)
更新数量
>>: ## [Day27] Video Speed Controller UI
前言 该系列是为了让看过Vue官方文件或学过Vue但是却不知道怎麽下手去重构现在有的网站而去规画的系...
前言 要读取 .pkl 档,结果遇到各种状况,在网路上查了许多资料後终於解决了! 在这边简单做个过程...
使用上跟MethodChannel类似,EventChannel即为MethodChannel与St...
Hello, 各位 iT邦帮忙 的粉丝们大家好~~~ 本篇是 Re: 从零开始用 Xamarin 技...
变数与型别(二) 变数 简单回顾一下,变数的宣告方式 let catNum = 3; 用比较口语的方...