Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def show_spatial_series(node: SpatialSeries, **kwargs):
data, unit = get_timeseries_in_units(node)
tt = get_timeseries_tt(node)
if len(data.shape) == 1:
fig, ax = plt.subplots()
ax.plot(tt, data, **kwargs)
ax.set_xlabel('t (sec)')
if unit:
ax.set_xlabel('x ({})'.format(unit))
else:
ax.set_xlabel('x')
ax.set_ylabel('x')
elif data.shape[1] == 2:
fig, ax = plt.subplots()
ax.plot(data[:, 0], data[:, 1], **kwargs)
if unit:
def show_spatial_series_over_time(node: SpatialSeries, **kwargs):
text_widget = base.show_text_fields(
node, exclude=('timestamps_unit', 'comments', 'data', 'timestamps', 'interval'))
data, unit = get_timeseries_in_units(node)
if len(data.shape) == 1:
ndims = 1
else:
ndims = data.shape[1]
tt = get_timeseries_tt(node)
if ndims == 1:
fig, ax = plt.subplots()
ax.plot(tt, data, **kwargs)
ax.set_xlabel('t (sec)')
if unit:
ax.set_ylabel('x ({})'.format(unit))
else:
ax.set_ylabel('x')
def show_timeseries_mpl(node: TimeSeries, neurodata_vis_spec=None, istart=0, istop=None, ax=None, zero_start=False,
xlabel=None, ylabel=None, title=None, **kwargs):
if xlabel is None:
xlabel = 'time (s)'
if ylabel is None and node.unit:
ylabel = node.unit
if ax is None:
fig, ax = plt.subplots()
tt = get_timeseries_tt(node, istart=istart, istop=istop)
if zero_start:
tt = tt - tt[0]
data, unit = get_timeseries_in_units(node, istart=istart, istop=istop)
ax.plot(tt, data, **kwargs)
ax.set_xlabel(xlabel)
if node.unit:
ax.set_ylabel(ylabel)
if title is not None:
ax.set_title(title)
ax.autoscale(enable=True, axis='x', tight=True)
return ax