Mismatch in sw.plot_timeseries
Hi all,

when we use a multishank probe, we observe a mismatch between the probe mapping and the order in which the channels are plotted using sw.plot_timeseries when the boolean "order_channel_by_depth=True".
The Y axis of the plot does not have the channels organized based on their depth position. However, when we use a linear probe we dont have this issue.
Any suggestions?


diff --git a/spikeinterface/widgets/tests/test_widgets.py b/spikeinterface/widgets/tests/test_widgets.py
index fb83a8dd..295c9f0e 100644
--- a/spikeinterface/widgets/tests/test_widgets.py
+++ b/spikeinterface/widgets/tests/test_widgets.py
@@ -197,10 +197,10 @@ if __name__ == '__main__':
     mytest = TestWidgets()
     mytest.setUp()
     
-    # mytest.test_plot_timeseries()
+    mytest.test_plot_timeseries()
     
     # mytest.test_plot_unit_waveforms()
     # mytest.test_plot_unit_templates()
-    mytest.test_plot_unit_templates()
+    # mytest.test_plot_unit_templates()
 
     plt.show()
diff --git a/spikeinterface/widgets/timeseries.py b/spikeinterface/widgets/timeseries.py
index a039f7c5..14f0070a 100644
--- a/spikeinterface/widgets/timeseries.py
+++ b/spikeinterface/widgets/timeseries.py
@@ -204,6 +204,9 @@ def _get_trace_list(recordings, channel_ids, time_range, segment_index, order=No
     time_range = frame_range / fs
     times = np.arange(frame_range[0], frame_range[1]) / fs
 
+    if order is not None:
+        channel_ids = np.array(channel_ids)[order]
+
     list_traces = []
     for rec_name, rec in recordings.items():
         traces = rec.get_traces(
@@ -215,8 +218,6 @@ def _get_trace_list(recordings, channel_ids, time_range, segment_index, order=No
 
         if order is not None:
             traces = traces[:, order]
-            channel_ids = np.asarray(channel_ids)[order]
-
         list_traces.append(traces)
-    
+
     return times, list_traces, frame_range, channel_ids
\\ No newline at end of file
['spikeinterface/widgets/timeseries.py', 'spikeinterface/widgets/tests/test_widgets.py']