I'm running a program through shell on windows and keep getting this deprecation error. Here is the code being ran and the error message:
Code: class Window: """ Window to draw a gridworld instance using Matplotlib """
def __init__(self, title):
self.fig = None
self.imshow_obj = None
# Create the figure and axes
self.fig, self.ax = plt.subplots()
# Show the env name in the window title
self.fig.canvas.set_window_title(title)
# Turn off x/y axis numbering/ticks
self.ax.set_xticks([], [])
self.ax.set_yticks([], [])
# Flag indicating the window was closed
self.closed = False
def close_handler(evt):
self.closed = True
self.fig.canvas.mpl_connect('close_event', close_handler)
def show_img(self, img):
Error: /home/msaidi/gym-minigrid/gym_minigrid/window.py:31: MatplotlibDeprecationWarning: Passing the minor parameter of set_xticks() positionally is deprecated since Matplotlib 3.2; the parameter will become keyword-only two minor releases later. self.ax.set_xticks([], []) /home/msaidi/gym-minigrid/gym_minigrid/window.py:32: MatplotlibDeprecationWarning: Passing the minor parameter of set_yticks() positionally is deprecated since Matplotlib 3.2; the parameter will become keyword-only two minor releases later. self.ax.set_yticks([], [])
When I compile the code in the ide I don't get any errors.
I tried changing from self.ax.set_xticks to set_xticks and to ax.set_xticks and self.set_xticks and didn't work.
Matplotlib version: 3.2.1 python3 running through (ubuntu windows application)
You need to separate tick values and tick labels.
ax.set_xticks([]) # values
ax.set_xticklabels([]) # labels
Just change it to:
self.ax.set_xticks([])
self.ax.set_yticks([])
The error says that the second parameter cannot be given positionally, meaning that you need to explicitly give the parameter name minor=False for the second parameter or remove the second parameter in your case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With