Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added customizable plot titles #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
7 changes: 5 additions & 2 deletions pretty_confusion_matrix/pretty_confusion_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def pp_matrix(
figsize=[8, 8],
show_null_values=0,
pred_val_axis="y",
title='Confusion Matrix',
):
"""
print conf matrix with default layout (like matlab)
Expand Down Expand Up @@ -234,7 +235,7 @@ def pp_matrix(
ax.text(item["x"], item["y"], item["text"], **item["kw"])

# titles and legends
ax.set_title("Confusion matrix")
ax.set_title(title)
ax.set_xlabel(xlbl)
ax.set_ylabel(ylbl)
plt.tight_layout() # set layout slim
Expand All @@ -254,6 +255,7 @@ def pp_matrix_from_data(
figsize=[8, 8],
show_null_values=0,
pred_val_axis="lin",
title="Confusion Matrix",
):
"""
plot confusion matrix function with y_test (actual values) and predictions (predic),
Expand All @@ -268,7 +270,7 @@ def pp_matrix_from_data(

columns = [
"class %s" % (i)
for i in list(ascii_uppercase)[0 : len(np.unique(y_test))]
for i in list(ascii_uppercase)[0: len(np.unique(y_test))]
]

confm = confusion_matrix(y_test, predictions)
Expand All @@ -280,4 +282,5 @@ def pp_matrix_from_data(
figsize=figsize,
show_null_values=show_null_values,
pred_val_axis=pred_val_axis,
title=title,
)