Skip to content

Commit 1f7860d

Browse files
committed
Enhance plot_probegroup to handle varying contact colors & values for each probe
1 parent 4cb28b6 commit 1f7860d

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/probeinterface/plotting.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,21 @@ def plot_probegroup(probegroup, same_axes: bool = True, **kargs):
307307
kargs["zlims"] = None
308308

309309
kargs["title"] = False
310+
311+
cum_contact_cnt = 0
312+
total_contacts = sum(p.get_contact_count() for p in probegroup.probes)
313+
310314
for i, probe in enumerate(probegroup.probes):
311-
plot_probe(probe, ax=axs[i], **kargs)
315+
n = probe.get_contact_count()
316+
kargs_probe = kargs.copy()
317+
for key in ["contacts_colors", "contacts_values", "text_on_contact"]:
318+
if key in kargs and kargs[key] is not None:
319+
val = kargs[key]
320+
if hasattr(val, "__len__") and len(val) == total_contacts:
321+
kargs_probe[key] = val[cum_contact_cnt : cum_contact_cnt + n]
322+
323+
plot_probe(probe, ax=axs[i], **kargs_probe)
324+
cum_contact_cnt += n
312325

313326

314327
def plot_probe_group(probegroup, same_axes: bool = True, **kargs):

0 commit comments

Comments
 (0)