Skip to content

Commit

Permalink
add show_labels option to plot_roc reiinakano#116
Browse files Browse the repository at this point in the history
  • Loading branch information
celik-muhammed committed Aug 16, 2024
1 parent 9111ce5 commit 75621df
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions scikitplot/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,10 @@ def plot_roc_curve(y_true, y_probas, title='ROC Curves',


def plot_roc(y_true, y_probas, title='ROC Curves',
plot_micro=True, plot_macro=True, classes_to_plot=None,
ax=None, figsize=None, cmap='nipy_spectral',
title_fontsize="large", text_fontsize="medium"):
plot_micro=True, plot_macro=True, classes_to_plot=None,
ax=None, figsize=None, cmap='nipy_spectral',
title_fontsize="large", text_fontsize="medium",
show_labels=True,):
"""Generates the ROC curves from labels and predicted scores/probabilities
Args:
Expand Down Expand Up @@ -372,6 +373,9 @@ def plot_roc(y_true, y_probas, title='ROC Curves',
text_fontsize (string or int, optional): Matplotlib-style fontsizes.
Use e.g. "small", "medium", "large" or integer-values. Defaults to
"medium".
show_labels (boolean, optional): Shows the labels in the plot.
Defaults to ``True``.
Returns:
ax (:class:`matplotlib.axes.Axes`): The axes on which the plot was
Expand Down Expand Up @@ -455,7 +459,8 @@ def plot_roc(y_true, y_probas, title='ROC Curves',
ax.set_xlabel('False Positive Rate', fontsize=text_fontsize)
ax.set_ylabel('True Positive Rate', fontsize=text_fontsize)
ax.tick_params(labelsize=text_fontsize)
ax.legend(loc='lower right', fontsize=text_fontsize)
if show_labels is True:
ax.legend(loc='lower right', fontsize=text_fontsize)
return ax


Expand Down

0 comments on commit 75621df

Please sign in to comment.