matplotlib随机漫步

import matplotlib.pyplot as plt
import time
import random as rd
plt.style.use('seaborn')
fig, ax = plt.subplots()
class RandomWalk:
    """生成一个随机漫步"""
    def __init__(self,np = 500):

        
        self.x = [0]
        self.y = [0]

    def fill(self,np = 500):
        self.np = np
        count = 0
        

        plt.style.use('seaborn')
        fig, ax = plt.subplots()
        while count <= np:
            xf = rd.choice([1,-1])
            xb = rd.choice([1,2,3,4,5])
            xz = xf*xb

            yf = rd.choice([1,-1])
            yb = rd.choice([1,2,3,4,5])
            yz = yf*yb
            
            ax.scatter(self.x[-1],self.y[-1])
            self.x.append(xz)
            self.y.append(yz)
        plt.show()


a = RandomWalk()
a.fill()

一个随机漫步的类,各位看一下,为什么我的一直显示不出来?

while count <= np:
count 的值一直是0,np一直是500
你这不是死循环嘛。
都没出循环,plt.show()都没执行