我正在Windows操作系统的shell中运行程序,但一直收到这个弃用错误(deprecation error)。以下是被运行的代码和错误信息:
代码: class Window: """ 一个使用Matplotlib绘制网格世界(Gridworld)实例的窗口 """
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):
错误: /home/msaidi/gym-minigrid/gym_minigrid/window.py:31:MatplotlibDeprecationWarning:自Matplotlib 3.2起,按位置传递set_xticks()的小参数已弃用;该参数将在两个小版本后变为仅限关键字。 self.ax.set_xticks([], []) /home/msaidi/gym-minigrid/gym_minigrid/window.py:32:MatplotlibDeprecationWarning:自Matplotlib 3.2起,按位置传递set_yticks()的小参数已弃用;该参数将在两个小版本后变为仅限关键字。 self.ax.set_yticks([], [])
当我在IDE中编译代码时,没有出现任何错误。
我尝试更改从self.ax.set_xticks到set_xticks和ax.set_xticks以及self.set_xticks,并不奏效。
Matplotlib版本:3.2.1 python3 运行通过(Ubuntu Windows应用程序)