Skip to content

Commit d0481b5

Browse files
authored
Fix IndexError during test_visualization_with__t_inf (#209)
Closes #206
1 parent ed44446 commit d0481b5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

petab/visualize/plotter.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ def generate_lineplot(
116116
if plotTypeData == REPLICATE:
117117
replicates = np.stack(
118118
measurements_to_plot.data_to_plot.repl.values)
119+
if replicates.ndim == 1:
120+
replicates = np.expand_dims(replicates, axis=1)
119121

120122
# plot first replicate
121123
p = ax.plot(
@@ -544,6 +546,8 @@ def _line_plot_at_t_inf(
544546
p = None
545547
if plotTypeData == REPLICATE:
546548
replicates = measurements_data_to_plot_inf.repl
549+
if replicates.ndim == 0:
550+
replicates = np.expand_dims(replicates, axis=0)
547551

548552
# plot first replicate
549553
p = ax_inf.plot(
@@ -587,6 +591,8 @@ def _line_plot_at_t_inf(
587591

588592
if plotTypeData == REPLICATE:
589593
replicates = simulations_data_to_plot_inf.repl
594+
if replicates.ndim == 0:
595+
replicates = np.expand_dims(replicates, axis=0)
590596

591597
# plot first replicate
592598
p = ax_inf.plot(

0 commit comments

Comments
 (0)