我制作了一个程序,它进行随机游走并绘制它。它运行良好,但每次运行程序时我都会收到警告。它说:
MatplotlibDeprecationWarning:
Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.
In a future version, a new instance will always be created and returned. Meanwhile, this warning can be suppressed,
and the future behavior ensured, by passing a unique label to each axes instance.
Run Code Online (Sandbox Code Playgroud)
该警告警告我,当我尝试删除 x 和 y 轴时 rw_visual.py
我的random_walk.py(如果你需要测试的话):
from random import choice
class RandomWalk():
"""A class to generate random walks."""
def __init__(self, num_points=5000):
"""Initialize attributes of a walk.""" …Run Code Online (Sandbox Code Playgroud)