-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscatter_plot.py
More file actions
executable file
·51 lines (40 loc) · 1.35 KB
/
scatter_plot.py
File metadata and controls
executable file
·51 lines (40 loc) · 1.35 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import numpy as np
import matplotlib.pyplot as plt
# Data matrix (3 groups x 2 subjects)
data_matrix = np.array([
[25.8667584859219, 8.00011681834696],
[0.776932118074478, 3.81829819436876],
[-5.00025374296094, -25.1086727847411] # PBS_with_Control_AAV
])
# Transpose so each subject's data is in a row
data_matrix_T = data_matrix.T
# Group and subject labels
group_labels = ['FAP_with_FAP_AAV', 'PBS_with_FAP_AAV', 'PBS_with_Control_AAV']
# subject_labels = ['Subject 1', 'Subject 2']
# Group-specific colors (matched from your line plot)
group_colors = {
'FAP_with_FAP_AAV': '#1f77b4', # Blue
'PBS_with_FAP_AAV': '#ff7f0e', # Orange
'PBS_with_Control_AAV': '#2ca02c' # Green
}
# Create plot
fig, ax = plt.subplots(figsize=(6, 5))
# Plot each subject across all groups using group-specific colors
for i, subject_data in enumerate(data_matrix_T):
ax.scatter(
[1, 2, 3], # x = group positions
subject_data, # y = subject values
s=80,
color=[group_colors[label] for label in group_labels],
# label=subject_labels[i]
)
# Formatting
ax.set_xlim(0.5, 3.5)
ax.set_xticks([1, 2, 3])
ax.set_xticklabels(group_labels, rotation=15)
ax.set_ylabel('Signal Change (%)')
ax.set_title("Post Injection")
ax.grid(True)
ax.legend(loc='best')
plt.tight_layout()
plt.show()