magland / sortingview

Web app for viewing results of ephys spike sorting
Apache License 2.0
23 stars 7 forks source link

Add way to highlight intervals in TimeSeriesGraph #222

Closed edeno closed 7 months ago

edeno commented 11 months ago

As discussed in our meeting it would be useful to have a way to highlight intervals in a time series. It would also be helpful to be able to control the opacity and color. Ideally it would take an ndarray of shape (n_events, 2) where each column would be a start and stop time.

magland commented 11 months ago

I've implemented this as follows (this is available in the latest sortingview on pypi):

https://github.com/magland/sortingview/blob/cfd87cf6d7f71ce8e9d40e1e0de64ba034c37437/examples/example_timeseries_graph.py#L29-L30

And here is the example output:

https://figurl.org/f?v=gs://figurl/spikesortingview-10&d=sha1://f31e13f3972ca8d2cba1f7c99384c8ea20ba287d&label=Timeseries%20graph%20example

edeno commented 11 months ago

Thanks @magland. I am using this and it works great. One thing that would be handy is the ability to control the opacity. Is that difficult?

magland commented 11 months ago

@edeno I think you should be able to do this using rgba string for the color. Like color=rgba(50,50,255,0.5)

khl02007 commented 11 months ago

@magland It seems like this obscures the data behind it. https://figurl.org/f?v=gs://figurl/spikesortingview-10&d=sha1://a03cc1bb7e23bbb3fe3cea59a0c541e407040d33&label=MS22%20lineared%20sorted%20spikes%20classifier

Is it because I added the interval series after adding the line series?

edeno commented 11 months ago

The order of operations matters. You can also adjust the opacity

khl02007 commented 11 months ago

@magland also when you are zoomed in enough, the color of the interval disappears.

https://figurl.org/f?v=gs://figurl/spikesortingview-10&d=sha1://c582fcdbbfead42ec951baa349afac5f0e9e27ee&label=MS22%20lineared%20sorted%20spikes%20classifier