Skip to content

Commit 2545497

Browse files
authored
Vis: Handle missing data more gracefully (#175)
If there are no measurements for a plot, don't try to plot measurements. Also provides more informative messages if plotting fails.
1 parent ff1bdde commit 2545497

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

petab/visualize/plotter.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ def generate_lineplot(
9595

9696
label_base = dataplot.legendEntry
9797

98-
if measurements_to_plot is not None:
98+
if measurements_to_plot is not None \
99+
and not measurements_to_plot.data_to_plot.empty:
99100
# plotting all measurement data
100101

101102
if plotTypeData == REPLICATE:
@@ -376,7 +377,11 @@ def generate_figure(
376377
else:
377378
ax = axes[subplot.plotId]
378379

379-
self.generate_subplot(ax, subplot)
380+
try:
381+
self.generate_subplot(ax, subplot)
382+
except Exception as e:
383+
raise RuntimeError(
384+
f"Error plotting {getattr(subplot, PLOT_ID)}.") from e
380385

381386
if subplot_dir is not None:
382387
# TODO: why this doesn't work?

0 commit comments

Comments
 (0)