Skip to content

Commit

Permalink
plot_traces with cutoff (#99)
Browse files Browse the repository at this point in the history
* plot_traces with cutoff
  • Loading branch information
claudiacasellato committed Sep 15, 2020
1 parent d2157ac commit 1f94bf9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bsb/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,12 +675,14 @@ def hdf5_gather_voltage_traces(handle, root, groups=None):

@_figure
@_input_highlight
def plot_traces(traces, fig=None, show=True, legend=True):
def plot_traces(traces, fig=None, show=True, legend=True, mod=None, cutoff=0):
traces.order()
subplots_fig = make_subplots(
cols=1, rows=len(traces), subplot_titles=[trace.title for trace in traces]
)
subplots_fig.update_layout(height=len(traces) * 130)
if mod is not None:
mod(subplots_fig)
# Overwrite the layout and grid of the single plot that is handed to us
# to turn it into a subplots figure.
fig._grid_ref = subplots_fig._grid_ref
Expand All @@ -690,10 +692,10 @@ def plot_traces(traces, fig=None, show=True, legend=True):
for i, cell_traces in enumerate(traces):
for j, trace in enumerate(cell_traces):
showlegend = legends[j] not in legend_groups
trace.data = trace.data[cutoff:]
fig.append_trace(
go.Scatter(
x=trace.data[:, 0],
y=trace.data[:, 1],
y=trace.data,
legendgroup=legends[j],
name=legends[j],
showlegend=showlegend,
Expand Down

0 comments on commit 1f94bf9

Please sign in to comment.