Skip to content

Commit 3999582

Browse files
committed
Update figures
1 parent ba124ba commit 3999582

File tree

7 files changed

+404
-209
lines changed

7 files changed

+404
-209
lines changed

scripts/figures/plot_SGNsub_thresholds.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,25 @@ def plot_intensity_thresholds(input_dir, output_dir, cochlea, plot=False, sharex
5757
if cochlea in CUSTOM_THRESHOLDS and stain in CUSTOM_THRESHOLDS[cochlea]:
5858
rows = 2
5959
row_types = ["threshold", "custom"]
60+
columns = number_plots
6061
if custom_only:
61-
rows = 1
62+
rows = 2
6263
row_types = ["custom"]
64+
columns = number_plots // 2
65+
6366
else:
6467
rows = 1
6568
row_types = ["threshold"]
69+
columns = number_plots
6670

67-
columns = number_plots
68-
fig, axes = plt.subplots(rows, columns, figsize=(columns*4, rows*4), sharex=sharex)
71+
main_label_size = 20
72+
main_tick_size = 16
73+
fig, axes = plt.subplots(rows, columns, figsize=(columns*2.5, rows*2.5), sharex=sharex)
6974
ax = axes.flatten()
7075
table_path_s3, fs = get_s3_path(table_measurement_path)
7176
with fs.open(table_path_s3, "r") as f:
7277
table_measurement = pd.read_csv(f, sep="\t")
7378

74-
alias = ALIAS[cochlea]
7579
for enum, row_type in enumerate(row_types):
7680
if row_type == "threshold":
7781
for num, center_str in enumerate(center_strs):
@@ -88,8 +92,8 @@ def plot_intensity_thresholds(input_dir, output_dir, cochlea, plot=False, sharex
8892

8993
ax[enum*columns + num].hist(pos_values, bins=bins, alpha=0.6, label='Positive', color='tab:blue')
9094
ax[enum*columns + num].hist(neg_values, bins=bins, alpha=0.6, label='Negative', color='tab:orange')
91-
ax[enum*columns + num].set_ylabel('Count')
92-
ax[enum*columns + num].set_xlabel('Intensity')
95+
ax[enum*columns + num].set_ylabel('Count', fontsize=main_label_size)
96+
ax[enum*columns + num].set_xlabel('Intensity', fontsize=main_label_size)
9397
ax[enum*columns + num].legend()
9498
if title_type == "center_str":
9599
ax[enum*columns + num].set_title(center_str)
@@ -116,16 +120,18 @@ def plot_intensity_thresholds(input_dir, output_dir, cochlea, plot=False, sharex
116120
label='Positive', color='tab:blue')
117121
ax[enum*columns + num].hist(neg_values, bins=bins, alpha=0.6,
118122
label='Negative', color='tab:orange')
119-
ax[enum*columns + num].set_ylabel('Count')
120-
ax[enum*columns + num].set_xlabel('Intensity')
123+
ax[enum*columns + num].set_ylabel('Count', fontsize=main_label_size)
124+
ax[enum*columns + num].set_xlabel('Intensity', fontsize=main_label_size)
125+
ax[enum*columns + num].tick_params(axis='x', labelsize=main_tick_size)
126+
ax[enum*columns + num].tick_params(axis='y', labelsize=main_tick_size)
121127
ax[enum*columns + num].legend()
122128
if title_type == "center_str":
123-
ax[enum*columns + num].set_title(center_str)
129+
ax[enum*columns + num].set_title(center_str, fontsize=main_label_size)
124130
else:
125131
ax[enum*columns + num].set_title(f"Crop {str(num+1).zfill(1)}")
126132

133+
alias = ALIAS[cochlea]
127134
fig.suptitle(f"{alias} - {stain}", fontsize=30)
128-
129135
plt.tight_layout()
130136

131137
if ".png" in save_path:

scripts/figures/plot_fig2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import matplotlib.pyplot as plt
77
import matplotlib.ticker as mticker
88

9-
from util import literature_reference_values, get_function_handle, get_flatline_handle, SYNAPSE_DIR_ROOT
9+
from util import literature_reference_values, get_marker_handle, get_flatline_handle, SYNAPSE_DIR_ROOT
1010
from util import prism_style, prism_cleanup_axes, export_legend, custom_formatter_2
1111

1212
png_dpi = 300
@@ -164,7 +164,7 @@ def supp_fig_02(save_path, plot=False, segm="SGN", mode="precision"):
164164

165165
# Labels and formatting
166166
x_pos = np.arange(1, len(labels)+1)
167-
plt.xticks(x_pos, labels, fontsize=16)
167+
plt.xticks(x_pos, labels, fontsize=main_tick_size)
168168
plt.yticks(fontsize=main_tick_size)
169169
plt.ylabel("Value", fontsize=main_label_size)
170170
plt.ylim(-0.1, 1)
@@ -223,7 +223,7 @@ def plot_legend_fig02c(save_path, plot_mode="shapes"):
223223
marker = ["o", "s"]
224224
label = ["Manual", "Automatic"]
225225

226-
handles = [get_function_handle(c, m) for (c, m) in zip(color, marker)]
226+
handles = [get_marker_handle(c, m) for (c, m) in zip(color, marker)]
227227
legend = plt.legend(handles, label, loc=3, ncol=len(label), framealpha=1, frameon=False)
228228
export_legend(legend, save_path)
229229
legend.remove()
@@ -454,7 +454,7 @@ def main():
454454
plot=args.plot, plot_average_ribbon_synapses=True)
455455

456456
# Supplementary Figure 2: Comparing other methods in terms of segmentation accuracy and runtime
457-
plot_legend_suppfig02(save_path=os.path.join(args.figure_dir, f"suppfig02_legend_colors.{FILE_EXTENSION}"))
457+
plot_legend_suppfig02(save_path=os.path.join(args.figure_dir, f"figsupp_02_legend_colors.{FILE_EXTENSION}"))
458458
supp_fig_02(save_path=os.path.join(args.figure_dir, f"figsupp_02_sgn.{FILE_EXTENSION}"), segm="SGN")
459459
supp_fig_02(save_path=os.path.join(args.figure_dir, f"figsupp_02_ihc.{FILE_EXTENSION}"), segm="IHC")
460460
supp_fig_02(save_path=os.path.join(args.figure_dir, f"figsupp_02_sgn_time.{FILE_EXTENSION}"),

0 commit comments

Comments
 (0)