Skip to content
Snippets Groups Projects
Commit 6a6034fb authored by brandhoj95's avatar brandhoj95
Browse files

added colored tracks

parent 06bfd9fa
No related branches found
No related tags found
1 merge request!49added colored tracks
Pipeline #65108 passed
...@@ -928,7 +928,7 @@ class File(h5py.File): ...@@ -928,7 +928,7 @@ class File(h5py.File):
else: else:
step_size = poses.shape[1] step_size = poses.shape[1]
cmap = matplotlib.cm.get_cmap(cmap) cmap = plt.get_cmap(cmap)
x_world, y_world = self.world_size x_world, y_world = self.world_size
if figsize is None: if figsize is None:
...@@ -951,6 +951,10 @@ class File(h5py.File): ...@@ -951,6 +951,10 @@ class File(h5py.File):
this_c = c this_c = c
timesteps = poses.shape[1] - 1 timesteps = poses.shape[1] - 1
colours = plt.get_cmap(cmap)(np.linspace(0, 1, 1 + timesteps // step_size))
if not lw_distances:
colours[:] = this_c
for t in range(0, timesteps, step_size): for t in range(0, timesteps, step_size):
if lw_distances: if lw_distances:
lw = np.mean(line_width[t : t + step_size + 1]) lw = np.mean(line_width[t : t + step_size + 1])
...@@ -958,7 +962,7 @@ class File(h5py.File): ...@@ -958,7 +962,7 @@ class File(h5py.File):
ax.plot( ax.plot(
poses[fish_id, t : t + step_size + 1, 0], poses[fish_id, t : t + step_size + 1, 0],
poses[fish_id, t : t + step_size + 1, 1], poses[fish_id, t : t + step_size + 1, 1],
c=this_c, c=colours[t//step_size],
lw=lw, lw=lw,
) )
# Plotting outside of the figure to have the label # Plotting outside of the figure to have the label
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment