fix(scatter_legend): 基础版散点图 legend 移出画布防止遮挡
src/postprocessing/visualization_reports.py plot_scatter_true_vs_pred: ax.legend 加 bbox_to_anchor=(1.02, 1) + borderaxespad=0,将图例移到画布右侧外部。 已有 plt.tight_layout() 与 plt.savefig(..., bbox_inches='tight') 自动处理裁剪。 Why: loc='upper left' 时图例位于散点区左上角,训练/测试点集中时易被遮挡。 仅改基础版(plot_scatter_true_vs_pred),增强版 sctter_batch.py 是 gridspec 4x4 子图布局,硬套 bbox_to_anchor 会破坏右侧 ax_hist_y 子图,保留原样。
This commit is contained in:
@ -133,7 +133,7 @@ class WaterQualityVisualization:
|
|||||||
ax.set_xlabel(f'真实值 ({target_name})', fontsize=14, fontweight='bold')
|
ax.set_xlabel(f'真实值 ({target_name})', fontsize=14, fontweight='bold')
|
||||||
ax.set_ylabel(f'预测值 ({target_name})', fontsize=14, fontweight='bold')
|
ax.set_ylabel(f'预测值 ({target_name})', fontsize=14, fontweight='bold')
|
||||||
ax.set_title(f'{target_name} - 真实值 vs 预测值', fontsize=16, fontweight='bold')
|
ax.set_title(f'{target_name} - 真实值 vs 预测值', fontsize=16, fontweight='bold')
|
||||||
ax.legend(loc='upper left', fontsize=11)
|
ax.legend(loc='upper left', fontsize=11, bbox_to_anchor=(1.02, 1), borderaxespad=0)
|
||||||
ax.grid(True, alpha=0.3)
|
ax.grid(True, alpha=0.3)
|
||||||
|
|
||||||
# 添加指标文本框
|
# 添加指标文本框
|
||||||
|
|||||||
Reference in New Issue
Block a user