Skip to content

Commit 1bebd15

Browse files
authored
Vis: fix replicates sorting (#232)
Fixed ordering of replicates by timepoints
1 parent 91ba4dc commit 1bebd15

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

petab/visualize/plotter.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,23 @@ def generate_lineplot(
123123
replicates = np.stack(
124124
measurements_to_plot.data_to_plot.repl.values
125125
)
126+
# sorts according to ascending order of conditions
127+
cond, replicates = zip(
128+
*sorted(
129+
zip(
130+
measurements_to_plot.conditions,
131+
replicates
132+
)
133+
)
134+
)
135+
replicates = np.stack(replicates)
136+
126137
if replicates.ndim == 1:
127138
replicates = np.expand_dims(replicates, axis=1)
128139

129140
# plot first replicate
130141
p = ax.plot(
131-
measurements_to_plot.conditions,
142+
cond,
132143
replicates[:, 0],
133144
linestyle="-.",
134145
marker="x",
@@ -138,7 +149,7 @@ def generate_lineplot(
138149

139150
# plot other replicates with the same color
140151
ax.plot(
141-
measurements_to_plot.conditions,
152+
cond,
142153
replicates[:, 1:],
143154
linestyle="-.",
144155
marker="x",

0 commit comments

Comments
 (0)