hic3defdr.plotting.fn_vs_fp module

hic3defdr.plotting.fn_vs_fp.plot_fn_vs_fp(eval_results, labels, threshold=0.15, colors=None, xlabel='label', **kwargs)[source]

Plots two bar plots, one showing FNR and the other showing FPR at a fixed threshold.

Parameters:
  • eval_results (list of dict-like or list of list of dict-like) – The dicts should have keys ‘thresh’, ‘fpr’, and ‘tpr’ whose values are parallel vectors describing the thresholds, FPRs, and TPRs to use for the bar plots. Each dict in the list represents a different bar which will be added to each bar plot. Pass a nested list of dicts to draw grouped bar plots, denoting the outer list by color and the inner list by x-axis position.
  • labels (list of str or (list of str, list of str)) – List of labels parallel to eval_results providing names for each bar. If eval_results is a nested list, pass a tuple of two lists. The first list should provide the labels for the outer list grouping (len(labels[0]) == len(eval_results)) and the second should provide the labels for the inner list grouping (len(labels[1]) == len(eval_results[i]) for any i).
  • threshold (float) – The fixed threshold at which the FNR and FPR will be plotted. In practice, this function will use the closest threshold found in each dict in eval_results.
  • colors (matplotlib color or list of colors, optional) – Specify the color to use for the bars in the bar plot. If eval_results is a nested list, pass a list of colors to color core the outer list grouping (len(colors) == len(eval_results)). Pass None to use automatic colors.
  • xlabel (str) – The label to use for the x-axis.
  • kwargs (kwargs) – Typical plotter kwargs.
Returns:

The first pyplot axis returned is injected by @plotter. The array of pyplot axes is the second return value from the call to plt.subplots() that is used to create the pair of barplots.

Return type:

pyplot axis, array of pyplot axes