Skip to content
Advertisement

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

this easy example from matplotlib throws the mentioned error:

https://matplotlib.org/stable/gallery/lines_bars_and_markers/barchart.html

I also cannot find any typo according to the documentation of set_xticks():

https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.set_xticks.html

Can anyone provide clearification and some help, please?

Kind regards, Daniel

Advertisement

Answer

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
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement