rasbt / mlxtend

A library of extension and helper modules for Python's data analysis and machine learning libraries.
https://rasbt.github.io/mlxtend/
Other
4.82k stars 853 forks source link

Error: axis() got an unexpected keyword argument 'y_min' #1017

Closed sabarezaeii closed 1 year ago

sabarezaeii commented 1 year ago

Hello, I am having the same issue. I am trying to run a very simple example to check plot_decision_regions and I get the following error:

axis() got an unexpected keyword argument 'y_min'

my code:

X = np.array([[0.3,1],[0.5,4.5],[1,2.3],[1.4,1.9],[1.7,8.9],[2,4.1],[3.3,7],[3.5,1.5],[4,6.3],[4.4,1.9],[5.7,2.9],[6,7.1]]) y = np.array([0,0,0,0,0,0,1,1,1,1,1,1]) plot_decision_regions( X, y, clf=classifier, legend=2)

plt.show()

sabarezaeii commented 1 year ago

I also have tried this below code which I found in in your github http://rasbt.github.io/mlxtend/user_guide/plotting/plot_decision_regions/ and ran that both on a jupyter notebook on my computer and google Collab, and I gat the same error: axis() got an unexpected keyword argument 'y_min' !!

from mlxtend.plotting import plot_decision_regions import matplotlib.pyplot as plt from sklearn import datasets from sklearn.svm import SVC

iris = datasets.load_iris() X = iris.data[:, [0, 2]] y = iris.target

svm = SVC(C=0.5, kernel='linear') svm.fit(X, y)

plot_decision_regions(X, y, clf=svm, legend=2)

plt.xlabel('sepal length [cm]') plt.ylabel('petal length [cm]') plt.title('SVM on Iris') plt.show()

rasbt commented 1 year ago

Hm , that's weird. Haven't seen that before. What version of mlxtend are you using? Can you do an

import mlxtend
print(mlxtend.__version__)
sabarezaeii commented 1 year ago

Thanks for responding.

I have tried two different versions of mlxtend: 0.13.0 and 0.21.0

is that possible that matplotlib has updated something that caused this issue?

rasbt commented 1 year ago

Good point. Haven't updated my matplotlib in a while. What version are you using? I am currently on '3.5.1' where it works ok.

rasbt commented 1 year ago
Screen Shot 2023-02-23 at 3 19 19 PM
sabarezaeii commented 1 year ago

yesss, That was a matplotlib version problem. now I have matplotlib 3.5.3 and mlxtend 0.21.0, and everything is working.

thank you for your help.

rasbt commented 1 year ago

glad to hear that it could be (relatively) easily resolved!

rasbt commented 1 year ago

Ah sorry, forgot to ask: did you have an older or newer matplotlib version?

sabarezaeii commented 1 year ago

I had matplotlib 3.5.2.

rasbt commented 1 year ago

oh maybe an intermediate issue between 3.5.1 and 3.5.3 then hmmm