forked from saipo/astrbot_plugin_dajiao
Merge pull request '修改绘图bug' (#37) from saipo_test into master
Reviewed-on: saipo/astrbot_plugin_dajiao#37
This commit is contained in:
commit
f827007657
17
main.py
17
main.py
@ -5,6 +5,7 @@ from astrbot.api import logger
|
||||
import random
|
||||
from .back import time_long, volume, isUserExist, insertUser, seconds_to_hms, ml_to_l_ml, get_user_name
|
||||
import pymysql
|
||||
import matplotlib
|
||||
import matplotlib.pyplot as plt
|
||||
from .Tool import get_tool_name
|
||||
import astrbot.api.message_components as Comp
|
||||
@ -331,14 +332,14 @@ class MyPlugin(Star):
|
||||
for i in range(len(date)):
|
||||
day.append(date[i][0])
|
||||
volume.append(date[i][1])
|
||||
plt.pyplot.plot(day, volume)
|
||||
plt.pyplot.title('日产量')
|
||||
plt.pyplot.xlabel('日期')
|
||||
plt.pyplot.ylabel('日产量')
|
||||
plt.pyplot.xticks(day)
|
||||
plt.pyplot.grid()
|
||||
plt.pyplot.savefig('dayvolume.png')
|
||||
plt.pyplot.close()
|
||||
plt.plot(day, volume)
|
||||
plt.title('日产量')
|
||||
plt.xlabel('日期')
|
||||
plt.ylabel('日产量')
|
||||
plt.xticks(day)
|
||||
plt.grid()
|
||||
plt.savefig('dayvolume.png')
|
||||
plt.close()
|
||||
with open('dayvolume.png', 'rb') as f:
|
||||
image_data = f.read()
|
||||
image = Comp.Image.fromBytes(image_data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user