我在使用 Python Matplotlib.pyplot 时遇到以下错误:MatplotlibDeprecationWarning。 该程序的主要目标是将图形着色为灰色。
代码:
import openpyxl as xl
from matplotlib import pyplot as plt
print("")
print("Test")
print("")
print("")
wb = xl.load_workbook("test.xlsx")
sheet = wb.active
lsta = []
lstb = []
def func(col, lst):
sp = list(sheet[col])
for e in sp:
lst.append(e.value)
func("A", lsta)
func("B", lstb)
result = [x - y for x, y in zip(lsta, lstb)]
e = max(result)
s = min(result)
index = list((f"M{e}" for e in range(1, len(result)+1)))
fig = plt.figure(facecolor='grey')
plt.bar(index, result, color="green", edgecolor="purple", linewidth=2)
ax = plt.axes()
ax.set_facecolor("black")
for e in result:
print(e)
plt.show()