From c3e3101997dbe68f51855f5f90f48df0e033506a Mon Sep 17 00:00:00 2001 From: Beale John Henry Date: Wed, 31 Jan 2024 09:25:27 +0100 Subject: [PATCH] makes plot with labels --- clen_tools/detector-distance-refinement.py | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/clen_tools/detector-distance-refinement.py b/clen_tools/detector-distance-refinement.py index becf872..35a1002 100644 --- a/clen_tools/detector-distance-refinement.py +++ b/clen_tools/detector-distance-refinement.py @@ -340,16 +340,16 @@ def plot_indexed_std( stats_df, ax1, ax2 ): ax2.tick_params(axis='y', labelcolor=color) # std_a plot - color = "lightsteelblue" - ax2.plot(stats_df.clen, stats_df.std_a, color=color) + color = "turquoise" + ax2.plot(stats_df.clen, stats_df.std_a, color=color, label="a" ) # std_b plot - color = "cornflowerblue" - ax2.plot(stats_df.clen, stats_df.std_b, color=color) + color = "deepskyblue" + ax2.plot(stats_df.clen, stats_df.std_b, color=color, label="b" ) # std_c plot color = "royalblue" - ax2.plot(stats_df.clen, stats_df.std_c, color=color) + ax2.plot(stats_df.clen, stats_df.std_c, color=color, label="c" ) def plot_indexed_std_alpha_beta_gamma( stats_df, ax1, ax2 ): @@ -366,16 +366,16 @@ def plot_indexed_std_alpha_beta_gamma( stats_df, ax1, ax2 ): ax2.tick_params(axis='y', labelcolor=color) # std_alpha plot - color = "limegreen" - ax2.plot(stats_df.clen, stats_df.std_alpha, color=color) + color = "yellow" + ax2.plot(stats_df.clen, stats_df.std_alpha, color=color, label="alpha" ) # std_beta plot - color = "darkgreen" - ax2.plot(stats_df.clen, stats_df.std_beta, color=color) + color = "green" + ax2.plot(stats_df.clen, stats_df.std_beta, color=color, label="beta" ) # std_gamma plot - color = "green" - ax2.plot(stats_df.clen, stats_df.std_gamma, color=color) + color = "darkolivegreen" + ax2.plot(stats_df.clen, stats_df.std_gamma, color=color, label="gamma" ) def scan( cwd, lst, sample, lab6_geom_file, centre_clen, cell_file, threshold, step_size ): @@ -447,6 +447,7 @@ def scrub_scan( scan_top_dir, scan ): plot_indexed_std(stats_df, ax1, ax2) plot_indexed_std_alpha_beta_gamma(stats_df, ax3, ax4) + fig.legend(loc="upper center") fig.tight_layout() plt.savefig("{0}.png".format(scan)) @@ -530,3 +531,4 @@ if __name__ == "__main__": print( "top working directory = {0}".format( cwd ) ) main( cwd, args.lst, args.sample, args.geom, args.central_distance, args.cell_file, threshold ) +