From 73c19d2490abefbe49c4b042f54d6ed474fd5be6 Mon Sep 17 00:00:00 2001 From: jsadler2 Date: Tue, 8 Aug 2023 16:26:57 -0500 Subject: [PATCH] [#184] rm unneeded functions from plot_pred --- .../python_scripts/plot_pred_performance.py | 54 ++----------------- 1 file changed, 3 insertions(+), 51 deletions(-) diff --git a/3_visualize/src/python_scripts/plot_pred_performance.py b/3_visualize/src/python_scripts/plot_pred_performance.py index 51059ed0..9906369f 100644 --- a/3_visualize/src/python_scripts/plot_pred_performance.py +++ b/3_visualize/src/python_scripts/plot_pred_performance.py @@ -25,12 +25,8 @@ # + -run_id = 215 +outdir = f"../../out" -outdir = f"../../out/pred_perf/{run_id}" - -if not os.path.exists(outdir): - os.makedirs(outdir) # - df_comb_reach = read_and_filter_df("reach", "val") @@ -46,7 +42,7 @@ def plot_by_site_or_holdout(data, x, kind, outfile, - col_order=['do_min', 'do_max'], + col_order=['do_min', 'do_mean', 'do_max'], order=None): plt.rcParams.update({'font.size': 14}) g = sns.catplot( @@ -71,39 +67,12 @@ def plot_by_site_or_holdout(data, x, kind, outfile, ax.set_axisbelow(True) g.axes.flatten()[0].set_ylabel("RMSE (mg O2/l)") - sns.move_legend(g, loc='lower left', bbox_to_anchor=(0.8, 0.1)) + sns.move_legend(g, loc='lower left', bbox_to_anchor=(0.9, 0.1)) # plt.tight_layout() plt.savefig(os.path.join(outdir, outfile), bbox_inches='tight', dpi=300) return g - # plt.show() - # plt.clf() - -# + -# g.set_xlabels? -# - -######## Barplot by site (temporal)############################################ -df_comb_reach_temporal = df_comb_reach[df_comb_reach["holdout_id"] == "temporal"] -plot_by_site_or_holdout( - df_comb_reach_temporal, "site_id", "bar", "val_results_by_site.jpg" -) - -df_temp_spatial = df_comb_reach[ - df_comb_reach["site_id"].isin(df_comb_reach_temporal.site_id.unique()) -] - -sns.catplot( - x="holdout_id", - y="rmse", - row="site_id", - col="variable", - hue="model_id", - data=df_temp_spatial, - kind="bar", - col_order=["do_min", "do_max"], -) -plt.savefig(os.path.join(outdir, "temporal_vs_spatial_holdouts.jpg"), dpi=300) ######## stripplot by site (temporal)########################################### df_comb_reach_temporal = df_comb_reach[df_comb_reach["holdout_id"] == "temporal"] @@ -111,14 +80,6 @@ def plot_by_site_or_holdout(data, x, kind, outfile, df_comb_reach_temporal, "site_id", "strip", "val_results_by_site_strip.jpg" ) - -######## stripplot by site (spatial)############################################ -df_comb_reach_spatial = df_comb_reach[df_comb_reach["holdout_id"] == "spatial similar"] -plot_by_site_or_holdout( - df_comb_reach_spatial, "site_id", "strip", "val_results_by_site_strip_spatial.jpg" -) - - ######## Barplot by holdout ###################################################### g = plot_by_site_or_holdout( df_reach_filt, @@ -126,16 +87,8 @@ def plot_by_site_or_holdout(data, x, kind, outfile, "bar", "val_results_by_holdout.jpg", order=["temporal", 'spatial similar', 'spatial dissimilar'], - col_order=['do_min', 'do_max'] ) -for ax in g.axes.flatten(): - ax.set_ylabel('') - -######## Stripplot by holdout #################################################### -plot_by_site_or_holdout( - df_reach_filt, "holdout_id", "strip", "val_results_by_holdout_strip.jpg" -) # - @@ -163,7 +116,6 @@ def plot_by_site_or_holdout(data, x, kind, outfile, # dodge=True, # order=month_order, hue_order=model_labels, - col_order=['do_min', 'do_max'] ) for ax in g.axes.flatten():