Creating a threshold-coded ROC plot in Python
Question: R's [ROCR package](http://rocr.bioinf.mpi-sb.mpg.de) provides options for ROC
curve plotting that will color code and label threshold values along the
curve:

![](http://i.stack.imgur.com/7MviA.png)

The closest I can get with Python is something like

    
    
    from sklearn.metrics import roc_curve
    fpr, tpr, thresholds = roc_curve(qualityTrain.PoorCare, qualityTrain.Pred1)
    plt.plot(fpr, tpr, label='ROC curve', color='b')
    plt.axes().set_aspect('equal')
    plt.xlim([-0.05, 1.05])
    plt.ylim([-0.05, 1.05])
    

which gives

![](http://i.stack.imgur.com/GaTXg.png)

Are there packages that provide functionality equivalent to R's ability to
label (using `print.cutoffs.at`) and color code (using `colorize`) thresholds?
Presumably this information is in `thresholds`, returned by
[`sklearn.metrics.roc_curve`](http://scikit-
learn.org/stable/modules/generated/sklearn.metrics.roc_curve.html), but I
can't figure out how to use it to color code and label the figure.


Answer: Look at this gist:

<https://gist.github.com/podshumok/c1d1c9394335d86255b8>

    
    
    roc_data = sklearn.metrics.roc_curve(...)
    plot_roc(*roc_data, label_every=5)
    

