Skip to content

Commit 540204d

Browse files
authored
Enhancement of figure caption for stage01 plot_traces block (#98)
* Enhancement of figure caption
1 parent ad44c3e commit 540204d

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

cobrawap/pipeline/stage01_data_entry/scripts/plot_traces.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def plot_traces(asig, channels):
2828
fig, ax = plt.subplots()
2929

3030
offset = np.max(np.abs(asig.as_array()[:,channels]))
31-
3231
for i, signal in enumerate(asig.as_array()[:,channels].T):
3332
ax.plot(asig.times, signal + i*offset)
3433

@@ -41,12 +40,17 @@ def plot_traces(asig, channels):
4140
y_coords = asig.array_annotations['y_coords']
4241
dim_x, dim_y = np.max(x_coords)+1, np.max(y_coords)+1
4342

44-
ax.text(ax.get_xlim()[1]*1.05, ax.get_ylim()[0],
45-
f'ANNOTATIONS FOR CHANNEL(s) {channels} \n'\
46-
+ '\n ANNOTATIONS:\n' + '\n'.join(annotations) \
47-
+ '\n\n ARRAY ANNOTATIONS:\n' + '\n'.join(array_annotations) +'\n' \
48-
+ f' t_start: {asig.t_start}; t_stop: {asig.t_stop} \n' \
49-
+ f' dimensions(x,y): {dim_x}, {dim_y}')
43+
ax.text(1.05, 0.5,
44+
f'ANNOTATIONS FOR CHANNEL(s): {channels}' + '\n' \
45+
+ '\n' \
46+
+ 'ANNOTATIONS:' + '\n' \
47+
+ ' - ' + '\n - '.join(annotations) + '\n' \
48+
+ '\n' \
49+
+ 'ARRAY ANNOTATIONS:' + '\n' \
50+
+ ' - ' + '\n - '.join(array_annotations) + '\n' \
51+
+ f' - t_start: {asig.t_start}; t_stop: {asig.t_stop}' + '\n' \
52+
+ f' - dimensions(x,y): {dim_x}, {dim_y}',
53+
ha='left', va='center', transform=ax.transAxes)
5054

5155
ax.set_xlabel(f'time [{asig.times.units.dimensionality.string}]')
5256
ax.set_ylabel(f'channels [in {asig.units.dimensionality.string}]')

0 commit comments

Comments
 (0)