mlxtend icon indicating copy to clipboard operation
mlxtend copied to clipboard

_AxesBase.axis() is called with incorrect arguments in plot_decision_regions()

Open albertjin opened this issue 5 years ago • 1 comments

I am referring to the function plot_decision_regions() in file mlxtend/plotting/decision_regions.py, at line 249,

ax.axis(xmin=xx.min(), xmax=xx.max(), y_min=yy.min(), y_max=yy.max())

This line causes a warning message :

.../site-packages/mlxtend/plotting/decision_regions.py:249: MatplotlibDeprecationWarning: Passing unsupported keyword arguments to axis() will raise a TypeError in 3.3.
  ax.axis(xmin=xx.min(), xmax=xx.max(), y_min=yy.min(), y_max=yy.max())

Here is the document of axis(),

def axis(self, *args, emit=True, **kwargs):
        """
        Convenience method to get or set some axis properties.

        Call signatures::

          xmin, xmax, ymin, ymax = axis()
          xmin, xmax, ymin, ymax = axis([xmin, xmax, ymin, ymax])
          xmin, xmax, ymin, ymax = axis(option)
          xmin, xmax, ymin, ymax = axis(**kwargs)
...

It indeed does not call the method with expected arguments and should simply changed as follows,

ax.axis([xx.min(), xx.max(), yy.min(), yy.max()])

albertjin avatar Mar 23 '20 01:03 albertjin

Thanks for the note, it looks like there's been some change in matplotlib recently (didn't get the warning in previous version). I can patch that via a PR

rasbt avatar Mar 23 '20 01:03 rasbt