plotのフォントを大きく

This commit is contained in:
agomizi1cm committed 2026-10-13 15:45:46 +09:00
1 parent 40591a15a0
commit 5019bf6275
1 file changed
+14 -3
+14 -3
View File
@@ -349,6 +349,8 @@ def make_plots(usable: Usable, thresholds: dict[float, dict[str, float]], out_di
except ImportError: except ImportError:
return [] return []
out_dir.mkdir(parents=True, exist_ok=True) out_dir.mkdir(parents=True, exist_ok=True)
axis_label_size = 14
tick_label_size = 13
ref = [(r, d) for r, d in usable if float(r["pitch_deg"]) == opt.pitch_ref] # type: ignore[arg-type] ref = [(r, d) for r, d in usable if float(r["pitch_deg"]) == opt.pitch_ref] # type: ignore[arg-type]
distances = sorted({float(r["distance_m"]) for r, _ in ref}) # type: ignore[arg-type] distances = sorted({float(r["distance_m"]) for r, _ in ref}) # type: ignore[arg-type]
if not distances: if not distances:
@@ -360,7 +362,10 @@ def make_plots(usable: Usable, thresholds: dict[float, dict[str, float]], out_di
ax.scatter([p[0] for p in pts], [p[1] for p in pts], s=18, alpha=0.7, label=f"{distance:g} m") ax.scatter([p[0] for p in pts], [p[1] for p in pts], s=18, alpha=0.7, label=f"{distance:g} m")
lim = max(abs(float(r["true_yaw_deg"])) for r, _ in ref) * 1.15 + 1 # type: ignore[arg-type] lim = max(abs(float(r["true_yaw_deg"])) for r, _ in ref) * 1.15 + 1 # type: ignore[arg-type]
ax.plot([-lim, lim], [-lim, lim], "k--", linewidth=1, label="y = x") ax.plot([-lim, lim], [-lim, lim], "k--", linewidth=1, label="y = x")
ax.set(xlabel="true yaw [deg]", ylabel="estimated yaw change [deg]", title="Estimated vs true") ax.set(title="Estimated vs true")
ax.set_xlabel("true yaw [deg]", fontsize=axis_label_size)
ax.set_ylabel("estimated yaw change [deg]", fontsize=axis_label_size)
ax.tick_params(axis="both", labelsize=tick_label_size)
ax.legend() ax.legend()
ax.grid(alpha=0.3) ax.grid(alpha=0.3)
fig.tight_layout() fig.tight_layout()
@@ -382,7 +387,10 @@ def make_plots(usable: Usable, thresholds: dict[float, dict[str, float]], out_di
if theta is not None: if theta is not None:
ax.axhline(theta, color="r", linestyle=":") ax.axhline(theta, color="r", linestyle=":")
ax.axhline(-theta, color="r", linestyle=":") ax.axhline(-theta, color="r", linestyle=":")
ax.set(title=f"Frame error by true yaw ({distance:g} m)", xlabel="true yaw [deg]", ylabel="error [deg]") ax.set(title=f"Frame error by true yaw ({distance:g} m)")
ax.set_xlabel("true yaw [deg]", fontsize=axis_label_size)
ax.set_ylabel("error [deg]", fontsize=axis_label_size)
ax.tick_params(axis="both", labelsize=tick_label_size)
fig.tight_layout() fig.tight_layout()
paths.append(out_dir / "accuracy_error_by_condition.png") paths.append(out_dir / "accuracy_error_by_condition.png")
fig.savefig(paths[-1]) fig.savefig(paths[-1])
@@ -393,7 +401,10 @@ def make_plots(usable: Usable, thresholds: dict[float, dict[str, float]], out_di
and abs(float(r["true_yaw_deg"])) <= opt.pool_max_angle for e in _errors(r, d)] # type: ignore[arg-type] and abs(float(r["true_yaw_deg"])) <= opt.pool_max_angle for e in _errors(r, d)] # type: ignore[arg-type]
if errors: if errors:
ax.hist(errors, bins=40, histtype="step", density=True, label=f"{distance:g} m") ax.hist(errors, bins=40, histtype="step", density=True, label=f"{distance:g} m")
ax.set(xlabel="error [deg]", ylabel="density", title=f"Frame error distribution (|true| <= {opt.pool_max_angle:g} deg)") ax.set(title=f"Frame error distribution (|true| <= {opt.pool_max_angle:g} deg)")
ax.set_xlabel("error [deg]", fontsize=axis_label_size)
ax.set_ylabel("density", fontsize=axis_label_size)
ax.tick_params(axis="both", labelsize=tick_label_size)
ax.legend() ax.legend()
fig.tight_layout() fig.tight_layout()
paths.append(out_dir / "accuracy_error_hist.png") paths.append(out_dir / "accuracy_error_hist.png")