From bf75f88ce06058fa19106d73910d5874f52cb46c Mon Sep 17 00:00:00 2001 From: Ryan James Date: Tue, 6 Oct 2026 10:47:57 -0600 Subject: [PATCH 1/2] I-diagram matrix: connect all dots, fill included variables and hollow excluded ones Co-authored-by: Cursor --- sofic/viz/idiagram.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sofic/viz/idiagram.py b/sofic/viz/idiagram.py index 5f0bb31..9cae6e2 100644 --- a/sofic/viz/idiagram.py +++ b/sofic/viz/idiagram.py @@ -300,16 +300,11 @@ def plot_information_diagram( for x, atom in zip(xs, plotted, strict=True): inside = set(atom.indices) color = colors[atom.role] - ys_inside = [] + ax_mat.plot([x, x], [0, n_vars - 1], color=color, lw=2.0, zorder=2) for var_index in range(n_vars): y = n_vars - 1 - var_index - if var_index in inside: - ax_mat.plot(x, y, "o", color=color, ms=8, zorder=3) - ys_inside.append(y) - else: - ax_mat.plot(x, y, "o", color="0.86", ms=8, zorder=2) - if len(ys_inside) > 1: - ax_mat.plot([x, x], [min(ys_inside), max(ys_inside)], color=color, lw=2.0, zorder=2) + face = color if var_index in inside else "white" + ax_mat.plot(x, y, "o", mfc=face, mec=color, mew=1.5, ms=8, zorder=3) ax_mat.set_xlim(-1.4, n - 0.5) # First gray strip is the top row at y = n_vars - 1, spanning From 49bbbf9155a56f096c713dc85d99662440efd0de Mon Sep 17 00:00:00 2001 From: Ryan James Date: Tue, 6 Oct 2026 10:52:34 -0600 Subject: [PATCH 2/2] I-diagram matrix: label each atom with its Jurgens & Crutchfield taxonomy name Co-authored-by: Cursor --- sofic/viz/idiagram.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sofic/viz/idiagram.py b/sofic/viz/idiagram.py index 9cae6e2..65a81e0 100644 --- a/sofic/viz/idiagram.py +++ b/sofic/viz/idiagram.py @@ -241,7 +241,7 @@ def plot_information_diagram( ) if figsize is None: - figsize = (max(9.0, 0.55 * n + 1.2), 5.6) + figsize = (max(9.0, 0.55 * n + 1.2), 6.4) n_legend = len(handles_by_group) ncol = _legend_ncols(figsize[0], n_legend) empty_patch = mpatches.Patch(facecolor="none", edgecolor="none", label=" ") @@ -314,8 +314,9 @@ def plot_information_diagram( ax_mat.set_ylim(-0.5, top) ax_mat.axhline(top, color="0.15", lw=1.0, solid_capstyle="butt", zorder=10) ax_mat.set_yticks([]) - ax_mat.set_xticks([]) - ax_mat.tick_params(axis="x", bottom=False, labelbottom=False) + ax_mat.set_xticks(xs) + ax_mat.set_xticklabels([atom.jurgens_label or atom.label for atom in plotted], rotation=90, fontsize=8) + ax_mat.tick_params(axis="x", length=0, pad=4) for spine in ax_mat.spines.values(): spine.set_visible(False) @@ -334,7 +335,8 @@ def plot_information_diagram( title_fontsize=8, ) - fig.subplots_adjust(left=0.075, right=0.98, top=0.93, bottom=0.05) + # Reserve a fixed ~0.85 in strip at the bottom for the rotated atom labels. + fig.subplots_adjust(left=0.075, right=0.98, top=0.93, bottom=0.85 / figsize[1]) # After layout, seat the matrix flush under the bar so the bar x-axis # (bottom spine) borders the top of the first gray strip. bar_pos = ax_bar.get_position()