We could add an explanation to the plot_decision_regions function to plot custom class names. E.g., like this
from mlxtend.plotting import plot_decision_regions
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.svm import SVC
# Loading some example data
iris = datasets.load_iris()
X = iris.data[:, [0, 2]]
y = iris.target
# Training a classifier
svm = SVC(C=0.5, kernel='linear')
svm.fit(X, y)
# Plotting decision regions
ax = plot_decision_regions(X, y, clf=svm)
handles, labels = ax.get_legend_handles_labels()
ax.legend(handles, ['Setosa', 'Versicolor', 'Virginica'],
framealpha=0.3, scatterpoints=1, loc='upper left')
plt.show()
We could add an explanation to the plot_decision_regions function to plot custom class names. E.g., like this