Skip to content

Commit 5808ac9

Browse files
committed
Save pdfs
1 parent 0fa75fa commit 5808ac9

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

scripts/plot_figures.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,12 @@
229229
# if application_xlims[data_label]:
230230
# ax_ci_ex.set_xlim(*application_xlims[data_label])
231231

232-
fig_ex.savefig(os.path.join(fig_dir, f'application_{data_label}.png'))
233-
fig_ex.savefig(os.path.join(fig_dir, f'application_{data_label}.svg'), transparent=True)
232+
fig_ex.savefig(os.path.join(fig_dir, f'application_{data_label}.png'))
233+
fig_ex.savefig(os.path.join(fig_dir, f'application_{data_label}.svg'), transparent=True)
234+
fig_ex.savefig(os.path.join(fig_dir, f'application_{data_label}.pdf'), transparent=True)
234235

235236
if output_application_vary_cases[data_label]:
236-
237+
237238
assert "Mix_C" in scores and "Mix_N" in scores
238239
res_file = os.path.join(out_dir, f"pe_results_vary_cases_{data_label}.pkl")
239240

@@ -291,7 +292,7 @@
291292
df_construct = pd.read_pickle(res_file)
292293

293294
# Plot results
294-
print("Plotting analysis of p_C vs. constructed p_C with {} scores...".format(data_label), flush=True)
295+
print(f"Plotting analysis of p_C vs. constructed p_C with {data_label} scores...", flush=True)
295296
with sns.axes_style("whitegrid"):
296297
fig, axes = plt.subplots(nrows=1, ncols=len(methods), sharex=True, sharey=True, figsize=(fig_width, fig_width/3))
297298
df_construct_tidy = df_construct.melt(var_name="Method",
@@ -316,6 +317,7 @@
316317

317318
fig.savefig(os.path.join(fig_dir, f'estimation_test_{data_label}.png'))
318319
fig.savefig(os.path.join(fig_dir, f'estimation_test_{data_label}.svg'), transparent=True)
320+
fig.savefig(os.path.join(fig_dir, f'estimation_test_{data_label}.pdf'), transparent=True)
319321

320322

321323
if output_characterisation[data_label]:
@@ -328,10 +330,11 @@
328330

329331
# Plot point estimates of p1
330332
if bool(point_estimates):
331-
print("Plotting characterisation of {} scores...".format(data_label), flush=True)
333+
print(f"Plotting characterisation of {data_label} scores...", flush=True)
332334
fig = plot_characterisation(point_estimates, proportions, sample_sizes, average=average)
333-
fig.savefig(os.path.join(fig_dir, 'point_characterise_{}.png'.format(data_label)))
334-
fig.savefig(os.path.join(fig_dir, 'point_characterise_{}.svg'.format(data_label)), transparent=True)
335+
fig.savefig(os.path.join(fig_dir, f'point_characterise_{data_label}.png'))
336+
fig.savefig(os.path.join(fig_dir, f'point_characterise_{data_label}.svg'), transparent=True)
337+
fig.savefig(os.path.join(fig_dir, f'point_characterise_{data_label}.pdf'), transparent=True)
335338

336339
# Plot bootstrapped estimates of p1
337340
if False: # bool(boots_estimates):
@@ -469,7 +472,7 @@
469472
mix_dfs[s].append(pd.read_pickle(mix_dist_file))
470473

471474
# Plot selected violins
472-
print("Plotting violins of constructed mixtures with {} scores...".format(data_label), flush=True)
475+
print(f"Plotting violins of constructed mixtures with {data_label} scores...", flush=True)
473476
plot_mixes = [selected_mix]
474477
figsize = (fig_width, len(sizes)*fig_width*0.3)
475478
for mix in plot_mixes: # range(n_seeds):
@@ -482,6 +485,7 @@
482485
figsize=figsize)
483486
fig.savefig(os.path.join(fig_dir, f'violin_selection_{mix}_{data_label}.png'))
484487
fig.savefig(os.path.join(fig_dir, f'violin_selection_{mix}_{data_label}.svg'), transparent=True)
488+
fig.savefig(os.path.join(fig_dir, f'violin_selection_{mix}_{data_label}.pdf'), transparent=True)
485489

486490

487491

0 commit comments

Comments
 (0)