def _verifier_plot_multiple( default_fig_suptitle: str, plot_config: PlotConfig, final_plot_data: tp.List[tp.Tuple[str, tp.Dict[str, tp.Any]]] ) -> None: fig = plt.figure() main_axis = fig.subplots() main_axis.set_xlim(0, 1) main_axis.grid(linestyle='--') main_axis.set_xlabel('Revisions normalized') main_axis.set_ylabel('Success rate in %') main_axis.yaxis.set_major_formatter(mtick.PercentFormatter(1.0)) fig.subplots_adjust(top=0.95, hspace=0.05, right=0.95, left=0.07) mean_over_all_project_successes = 0 for plot_data in final_plot_data: mean_over_all_project_successes += plot_data[1]["average_success_ratio" ] / len(final_plot_data) # Save an unique int for each varying revision to prepare the data # for the normalization on the x-axis revisions_as_numbers: npt.NDArray[np.int_] = np.array([ x + 1 for x, y in enumerate(plot_data[1]["revisions"]) ]).reshape(-1, 1) normalized_revisions = preprocessing.minmax_scale( revisions_as_numbers, (0, 1), axis=0, copy=False ) main_axis.plot( normalized_revisions, plot_data[1]["success_ratio"], label= f"{plot_data[0]}(\u2205 {plot_data[1]['average_success_ratio']}%)" ) main_axis.title.set_text(f"{plot_config.fig_title(default_fig_suptitle)}") plt.setp( main_axis.get_xticklabels(), rotation=30, horizontalalignment='right' ) legend = main_axis.legend( title=f"{plot_config.legend_title('Success rate of projects')}" f"(\u2205 {round(mean_over_all_project_successes, 2)}%):", loc='upper left', prop={ 'size': plot_config.legend_size(), 'family': 'monospace' } ) legend.set_visible(plot_config.show_legend()) plt.setp( legend.get_title(), fontsize=plot_config.legend_size(), family='monospace' )
def _verifier_plot_single( default_fig_suptitle: str, plot_config: PlotConfig, final_plot_data: tp.Tuple[str, tp.Dict[str, tp.Any]] ) -> None: fig, main_axis = plt.subplots() fig.suptitle(default_fig_suptitle, fontsize=plot_config.font_size(8)) main_axis.grid(linestyle='--') main_axis.set_xlabel('Revisions') main_axis.set_ylabel('Success/Failure rate in %') main_axis.yaxis.set_major_formatter(mtick.PercentFormatter(1.0)) fig.subplots_adjust(top=0.95, hspace=0.05, right=0.95, left=0.07) main_axis.stackplot( final_plot_data[1]["revisions"], final_plot_data[1]["success_ratio"], final_plot_data[1]["failure_ratio"], labels=[ f"successes(\u2205 {final_plot_data[1]['average_success_ratio']}%)", f"failures(\u2205 {final_plot_data[1]['average_failure_ratio']}%)" ], colors=[SUCCESS_COLOR, FAILED_COLOR], alpha=0.5 ) plt.setp( main_axis.get_xticklabels(), rotation=30, horizontalalignment='right' ) legend = main_axis.legend( title=plot_config.legend_title("Annotation types:"), loc='upper left', prop={ 'size': plot_config.legend_size(), 'family': 'monospace' } ) legend.set_visible(plot_config.show_legend) plt.setp( legend.get_title(), fontsize=plot_config.legend_size(), family='monospace' )