Skip to content

Commit

Permalink
fix replicates sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
plakrisenko committed Dec 11, 2023
1 parent c0158ba commit 3b9d89c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions petab/visualize/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,22 @@ def generate_lineplot(
replicates = np.stack(
measurements_to_plot.data_to_plot.repl.values
)
cond, replicates = zip(
*sorted(
zip(
measurements_to_plot.conditions,
replicates
)
)
)
replicates = np.stack(replicates)

if replicates.ndim == 1:
replicates = np.expand_dims(replicates, axis=1)

# plot first replicate
p = ax.plot(
measurements_to_plot.conditions,
cond,
replicates[:, 0],
linestyle="-.",
marker="x",
Expand All @@ -138,7 +148,7 @@ def generate_lineplot(

# plot other replicates with the same color
ax.plot(
measurements_to_plot.conditions,
cond,
replicates[:, 1:],
linestyle="-.",
marker="x",
Expand Down

0 comments on commit 3b9d89c

Please sign in to comment.