matplotlib.axes.Axes.set_xticks throws "set_ticks() takes 2 positional arguments but 3 were given"

Viewed 6280
2 Answers

This is error is based on the matplotlib version you use. The set_axis command was changed from matplotlib version 3.4.x to 3.5.x. Try using the newer version. You can install it via

$ pip install matplotlib==3.5.0

In my case I had forgotten to activate my Python virtual environment, so the interpreter was referencing an older version of matplotlib with no function named set_xticks.

Running pipenv shell before starting my script fixed the issue.

Related