target_var,
                        resample_method[target_var],
                        normalize_method[target_var],
                        imputer_method,
                        vars_to_load,
                        mode)
        ax = axes[i,j] 
        if i == 0:
            ax.set_title(plt_config.title_dict[target_var], fontsize=12) 
        base_plot.set_n_ticks(ax)
        base_plot.set_minor_ticks(ax)
        base_plot.despine_plt(ax)
        ax.grid(color='w')
        for model_name in results.keys():
            ax.plot(lead_times, results[model_name][metric], color=line_colors[model_name], label=model_name)

major_ax = base_plot.set_major_axis_labels(fig, xlabel='Lead time (minutes)', labelpad=40)
base_plot.add_alphabet_label(n_panels, axes, pos=(0.9, 0.09))
base_plot.set_legend(n_panels, fig, ax=axes.flat[0], major_ax=major_ax)

row_labels = [translate[m] for m in vars_to_load]
base_plot.set_row_labels(labels=row_labels, axes=axes, pos=0,
        rotation=90, pad=-0.2, fontsize=10)


fig_fname = f'metrics_different_lead_times_{time}.png'
my_plt._save_fig( fig=fig, fname = fig_fname)



Exemplo n.º 2
0
            pretty_probs_thresh = [5., 20, 40, 60, 80],
            csi_marker_size=100,
            add_ci=add_ci
            )
  
    title = plt_config.title_dict[target_var]

    if counter < len(ml_model_names)-1:
        ax.set_title(title, fontsize=base_plot.FONT_SIZES['normal'], alpha=0.9)

    counter+=1

# Add an letter per panel for publication purposes. 
base_plot.add_alphabet_label(n_panels, axes, pos=(0.9, 0.12))

base_plot.set_row_labels(labels=['FIRST HOUR', 'SECOND HOUR'], axes=axes, pos=0, rotation=90, pad=-0.2)

major_ax = base_plot.set_major_axis_labels(
            fig,
            xlabel='Success Ratio (1-FAR)',
            ylabel_left='Probability of Detection',
            labelpad = 35 
        )

# Every 5% 
# Line2D([0], [0], marker='o', color='w',
#                          markerfacecolor='k', markersize=6, alpha=0.8),

additional_handles = [
                    Line2D([0], [0], marker='X', color='w', markeredgecolor='k',
                        markerfacecolor='k', markersize=6, alpha=0.8),
        par1.tick_params(axis='y', colors=p2.get_color(), which='both', **tkw)
        par2.tick_params(axis='y', colors=p3.get_color(), which='both', **tkw)
        par3.tick_params(axis='y', colors=p4.get_color(), which='both', **tkw)
        host.tick_params(axis='x', **tkw)

        despine_plt(host)
        despine_plt(par1)
        despine_plt(par2)
        despine_plt(par3)
        par2.spines["right"].set_visible(True)
        par3.spines["right"].set_visible(True)

        plt.setp(par2.spines.values(), color='k', alpha=0.6)
        plt.setp(par3.spines.values(), color='k', alpha=0.6)

        host.set_xlabel(name[target], fontsize=10)

        i += 1

row_labels = [plt_config.title_dict[t] for t in target_set]
base_plot.set_row_labels(labels=row_labels,
                         axes=hosts,
                         pos=0,
                         rotation=90,
                         pad=-0.25,
                         fontsize=22)

base_plot.add_alphabet_label(6, hosts, pos=(0.05, 0.15), fontsize=13)

plt.savefig(f'tuning_uh_threshs.png', bbox_inches="tight", dpi=300)
Exemplo n.º 4
0
                    )
    if i %3 == 0:
        contours_set.append(contours)

    axes.text(0.0, 1.07, f'Init Time : {init_time_str}',fontsize=5,
            alpha=0.9, transform=axes.transAxes)
        
    axes.text(0.0, 1.02, f'Valid Time : {valid_time_str}',fontsize=5,
            alpha=0.9, transform=axes.transAxes)

    i+=1 

n_panels = nrows*ncols
base_plot.add_alphabet_label(n_panels, axes, pos=(0.9, 0.08))
row_labels = [plt_config.title_dict[t] for t in target_set]
base_plot.set_row_labels(labels=row_labels, axes=axes, pos=0, 
        rotation=90, pad=-0.25, colors = ['xkcd:pastel red', 'xkcd:medium green', 'xkcd:darkish blue'])

additional_handles = [
                    Line2D([0], [0], marker='o', color='w',
                          markerfacecolor='r', markersize=6, alpha=0.8),
                    Line2D([0], [0], marker='o', color='w',
                          markerfacecolor='b', markersize=6, alpha=0.8),
                     Line2D([0], [0], marker='o', color='w',
                          markerfacecolor='g', markersize=6, alpha=0.8),

                    Line2D([0], [0], color='b', alpha=0.8),

                     Line2D([0], [0], color='k', alpha=0.8),

                      ]
additional_labels = ['Tornado', 'Severe Wind', 'Severe Hail', 'WoFS PMM DBZ > 35', 'MRMS DBZ > 35']