scripts: plot.py/plotmpl.py: Stop dropping unlabeled datasets

That was confusing.

The -L/--label flag is already tricky enough to get right. Allowing
-L/--label to filter datasets is counter-intuitive and just makes it
harder to debug things.
This commit is contained in:
Christopher Haster
2025-02-05 16:30:40 -06:00
parent a3c97cdaeb
commit 995d942349
2 changed files with 15 additions and 5 deletions

View File

@ -543,12 +543,16 @@ def fold(results, by=None, x=None, y=None, defines=[], labels=None):
key_ += (y_,)
datasets[key_] = dataset
# filter/order by labels
# order by labels
if labels:
datasets_ = co.OrderedDict()
for _, key in labels:
if key in datasets:
datasets_[key] = datasets[key]
# include unlabeled data to help with debugging
for key, dataset in datasets.items():
if key not in datasets_:
datasets_[key] = datasets[key]
datasets = datasets_
return datasets
@ -1030,7 +1034,9 @@ def main(csv_paths, *,
if all_labels:
all_labels_ = {key: l for l, key in all_labels}
for i, name in enumerate(datasets_.keys()):
if all_labels and not all_labels_[name]:
if (all_labels
and name in all_labels_
and not all_labels_[name]):
continue
label = '%s%s' % (
'%s ' % datachars_[name]
@ -1039,7 +1045,7 @@ def main(csv_paths, *,
if line_chars is not None
else '',
all_labels_[name]
if all_labels
if all_labels and name in all_labels_
else ','.join(name))
if label: