Datasets:
File size: 2,855 Bytes
a863f79 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | import sys
from pathlib import Path
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.patches import FancyBboxPatch
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, "D:/GraphEvolve/figures_workspace/_utils")
import plot_utils as pu
pu.setup_style(palette="olive-apricot", language="en", font_family=["Arial", "DejaVu Sans"])
C = pu.COLORS
CONDITIONS = [
("T0", "direct question, no structure", C["light"]),
("T+", "asserted-true: the claim matches the geometry", C["primary"]),
("T-", "asserted-false: the claim contradicts the geometry", C["accent"]),
("T-empty", "missing edge: the asked relation is absent", C["secondary"]),
("Tu", "explicit unknown: the graph says it does not know", C["highlight"]),
]
W, H = 5.5, 2.4
fig = plt.figure(figsize=(W, H))
ax = fig.add_axes([0, 0, 1, 1])
ax.set_xlim(0, 1)
ax.set_ylim(-0.07, 1)
ax.axis("off")
ax.add_patch(FancyBboxPatch((0.03, 0.62), 0.44, 0.30, boxstyle="round,pad=0.012",
linewidth=1.0, edgecolor=C["primary"], facecolor="white"))
ax.text(0.25, 0.855, "state a: relation holds", ha="center", va="center", fontsize=7.5)
ax.text(0.25, 0.755, "camera and assets fixed,\npose differs", ha="center", va="center", fontsize=7)
ax.text(0.25, 0.66, "truth = yes", ha="center", va="center", fontsize=7, color=C["primary"])
ax.add_patch(FancyBboxPatch((0.53, 0.62), 0.44, 0.30, boxstyle="round,pad=0.012",
linewidth=1.0, edgecolor=C["accent"], facecolor="white"))
ax.text(0.75, 0.855, "state b: relation flips", ha="center", va="center", fontsize=7.5)
ax.text(0.75, 0.755, "same assets, materials,\nlights and question", ha="center", va="center", fontsize=7)
ax.text(0.75, 0.66, "truth = no", ha="center", va="center", fontsize=7, color=C["accent"])
y = 0.52
ax.annotate("", xy=(0.5, 0.60), xytext=(0.5, 0.55),
arrowprops=dict(arrowstyle="-|>", color="0.35", linewidth=0.8))
ax.text(0.5, 0.53, "each pair enters five textual conditions", ha="center", va="center", fontsize=7)
top = 0.44
step = 0.088
for i, (name, desc, color) in enumerate(CONDITIONS):
yy = top - i * step
ax.add_patch(FancyBboxPatch((0.05, yy - 0.028), 0.13, 0.056, boxstyle="round,pad=0.006",
linewidth=0.8, edgecolor=color, facecolor="white"))
ax.text(0.115, yy, name, ha="center", va="center", fontsize=7.5, color="black")
ax.text(0.21, yy, desc, ha="left", va="center", fontsize=7)
ax.text(0.05, -0.045, "net effect R = T - V and conditional gap K = T|correct - T|wrong",
ha="left", va="center", fontsize=6.8, color="0.3")
out_dir = ROOT / "figures"
out_dir.mkdir(parents=True, exist_ok=True)
for ext in ("pdf", "png"):
fig.savefig(out_dir / f"fig_design.{ext}", dpi=300, bbox_inches="tight")
plt.close(fig)
print("OK fig_design")
|