def plot_ROC(ROC, ax=None, opt_prob_thr=False):
    """
    Plot a ROC curve.

    Parameters
    ----------
    ROC: dict
        A ROC curve object created by probscores.ROC_curve_init.
    ax: axis handle, optional
        Axis handle for the figure. If set to None, the handle is taken from
        the current figure (matplotlib.pylab.gca()).
    opt_prob_thr: bool, optional
        If set to True, plot the optimal probability threshold that maximizes
        the difference between the hit rate (POD) and false alarm rate (POFD).

    """
    if ax is None:
        ax = plt.gca()

    POFD, POD, area = probscores.ROC_curve_compute(ROC, compute_area=True)
    p_thr = ROC["prob_thrs"]

    ax.plot([0, 1], [0, 1], "k--")
    ax.set_xlim(0, 1)
    ax.set_ylim(0, 1)
    ax.set_xlabel("False alarm rate (POFD)")
    ax.set_ylabel("Probability of detection (POD)")
    ax.grid(True, ls=":")

    ax.plot(POFD, POD, "kD-")

    if opt_prob_thr:
        opt_prob_thr_idx = np.argmax(np.array(POD) - np.array(POFD))
        ax.scatter(
            [POFD[opt_prob_thr_idx]],
            [POD[opt_prob_thr_idx]],
            c="r",
            s=150,
            facecolors=None,
            edgecolors="r",
        )

    for p_thr_, x, y in zip(p_thr, POFD, POD):
        ax.text(x + 0.02, y - 0.02, "%.2f" % p_thr_, fontsize=7)
Plot a ROC curve.

Parameters
----------
ROC: dict
A ROC curve object created by probscores.ROC_curve_init.
ax: axis handle, optional
Axis handle for the figure. If set to None, the handle is taken from
the current figure (matplotlib.pylab.gca()).
opt_prob_thr: bool, optional
If set to True, plot the optimal probability threshold that maximizes
the difference between the hit rate (POD) and false alarm rate (POFD).
pysteps/verification/plots.py