-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotting.py
30 lines (25 loc) · 979 Bytes
/
plotting.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Straightforward code to plot the FRAP curve generated by the export.py file (.csv)
# It will plot the average +- std of the normalized data
import pandas as pd
import matplotlib.pyplot as plt
csv_file_path = '/path/to/FRAP_data_give_name_here.csv'
data = pd.read_csv(csv_file_path)
number_of_rois = data['ROI Name'].nunique()
grouped_data = data.groupby('Time (s)')['Normalized Intensity'].agg(['mean', 'std'])
fig, ax = plt.subplots(figsize=(5,6))
ax.plot(grouped_data.index,
grouped_data['mean'],
label='Average Intensity',
color='purple')
ax.fill_between(grouped_data.index,
grouped_data['mean'] - grouped_data['std'],
grouped_data['mean'] + grouped_data['std'],
color='purple',
alpha=0.1,
label='Standard Deviation')
ax.set_xlabel('Time (s)')
ax.set_ylabel('Normalized Intensity')
ax.set_title(f'N={number_of_rois}')
ax.set_xlim(-10, 200)
ax.legend()
plt.show()