update task3
This commit is contained in:
@@ -36,7 +36,6 @@ from cycler import cycler
|
||||
|
||||
# 设置绘图风格(低饱和度 Morandi 色系)
|
||||
MORANDI = {
|
||||
"bg": "#F5F2ED",
|
||||
"grid": "#D7D1C7",
|
||||
"text": "#3F3F3F",
|
||||
"muted_blue": "#8FA3A7",
|
||||
@@ -46,17 +45,20 @@ MORANDI = {
|
||||
"warm_gray": "#8C857A",
|
||||
}
|
||||
|
||||
FIG_BG = "#FFFFFF"
|
||||
FIG_GRID = "#DADDE1"
|
||||
|
||||
plt.rcParams.update(
|
||||
{
|
||||
"figure.facecolor": MORANDI["bg"],
|
||||
"axes.facecolor": MORANDI["bg"],
|
||||
"savefig.facecolor": MORANDI["bg"],
|
||||
"axes.edgecolor": MORANDI["grid"],
|
||||
"figure.facecolor": FIG_BG,
|
||||
"axes.facecolor": FIG_BG,
|
||||
"savefig.facecolor": FIG_BG,
|
||||
"axes.edgecolor": FIG_GRID,
|
||||
"axes.labelcolor": MORANDI["text"],
|
||||
"xtick.color": MORANDI["text"],
|
||||
"ytick.color": MORANDI["text"],
|
||||
"text.color": MORANDI["text"],
|
||||
"grid.color": MORANDI["grid"],
|
||||
"grid.color": FIG_GRID,
|
||||
"grid.alpha": 0.55,
|
||||
"axes.grid": True,
|
||||
"axes.prop_cycle": cycler(
|
||||
@@ -70,8 +72,8 @@ plt.rcParams.update(
|
||||
),
|
||||
"legend.frameon": True,
|
||||
"legend.framealpha": 0.9,
|
||||
"legend.facecolor": MORANDI["bg"],
|
||||
"legend.edgecolor": MORANDI["grid"],
|
||||
"legend.facecolor": FIG_BG,
|
||||
"legend.edgecolor": FIG_GRID,
|
||||
"font.sans-serif": ["Arial Unicode MS", "SimHei", "DejaVu Sans"],
|
||||
"axes.unicode_minus": False,
|
||||
}
|
||||
@@ -436,7 +438,7 @@ for i, param in enumerate(params_list):
|
||||
ax.grid(True, alpha=0.55)
|
||||
|
||||
plt.tight_layout(rect=[0, 0.03, 1, 0.95])
|
||||
plt.savefig(OUTPUT_FIG, dpi=300)
|
||||
plt.savefig(OUTPUT_FIG, dpi=300, facecolor=FIG_BG)
|
||||
print(f"图表已保存至: {OUTPUT_FIG}")
|
||||
|
||||
# ============================================
|
||||
|
||||
Reference in New Issue
Block a user