Skip to content

Commit 75621df

Browse files
add show_labels option to plot_roc reiinakano#116
1 parent 9111ce5 commit 75621df

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

scikitplot/metrics.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,10 @@ def plot_roc_curve(y_true, y_probas, title='ROC Curves',
328328

329329

330330
def plot_roc(y_true, y_probas, title='ROC Curves',
331-
plot_micro=True, plot_macro=True, classes_to_plot=None,
332-
ax=None, figsize=None, cmap='nipy_spectral',
333-
title_fontsize="large", text_fontsize="medium"):
331+
plot_micro=True, plot_macro=True, classes_to_plot=None,
332+
ax=None, figsize=None, cmap='nipy_spectral',
333+
title_fontsize="large", text_fontsize="medium",
334+
show_labels=True,):
334335
"""Generates the ROC curves from labels and predicted scores/probabilities
335336
336337
Args:
@@ -372,6 +373,9 @@ def plot_roc(y_true, y_probas, title='ROC Curves',
372373
text_fontsize (string or int, optional): Matplotlib-style fontsizes.
373374
Use e.g. "small", "medium", "large" or integer-values. Defaults to
374375
"medium".
376+
377+
show_labels (boolean, optional): Shows the labels in the plot.
378+
Defaults to ``True``.
375379
376380
Returns:
377381
ax (:class:`matplotlib.axes.Axes`): The axes on which the plot was
@@ -455,7 +459,8 @@ def plot_roc(y_true, y_probas, title='ROC Curves',
455459
ax.set_xlabel('False Positive Rate', fontsize=text_fontsize)
456460
ax.set_ylabel('True Positive Rate', fontsize=text_fontsize)
457461
ax.tick_params(labelsize=text_fontsize)
458-
ax.legend(loc='lower right', fontsize=text_fontsize)
462+
if show_labels is True:
463+
ax.legend(loc='lower right', fontsize=text_fontsize)
459464
return ax
460465

461466

0 commit comments

Comments
 (0)