fix(bug): remove local matplotlib import shadowing global plt in stats
This commit is contained in:
@@ -518,7 +518,7 @@ async def stats(update: Update, context: CallbackContext):
|
|||||||
try:
|
try:
|
||||||
theme_colors = ['#3B82F6', '#10B981', '#F59E0B', '#EF4444', '#8B5CF6', '#EC4899', '#14B8A6', '#F97316', '#6366F1', '#84CC16']
|
theme_colors = ['#3B82F6', '#10B981', '#F59E0B', '#EF4444', '#8B5CF6', '#EC4899', '#14B8A6', '#F97316', '#6366F1', '#84CC16']
|
||||||
if len(category_costs) > len(theme_colors):
|
if len(category_costs) > len(theme_colors):
|
||||||
import matplotlib.pyplot as plt
|
# 移除导致遮蔽的局部 import,直接使用全局的 matplotlib 和 plt
|
||||||
extra_colors = [matplotlib.colors.to_hex(c) for c in plt.get_cmap('tab20').colors]
|
extra_colors = [matplotlib.colors.to_hex(c) for c in plt.get_cmap('tab20').colors]
|
||||||
theme_colors.extend(extra_colors)
|
theme_colors.extend(extra_colors)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user