# How to plot an ADC value from the Raspberry PI Pico using pythons matplotlib

Being new to Python and this community, I am trying to plot the pulse return from a transducer. The pulse return is 400 uSecs in duration and occurs every 100 milliseconds. So far I can plot the received values that are constantly being received and the plot graphs these in a strip chart fashion scrolling from right to left. I would like to be able to present the plot similar to how an oscilloscope would display the return pulse. I am not all that familiar with Numpy arrays yet. I am not sure what I am forgetting in writing the proper syntax for this. Here is a snippet of the code I am having issues with.

### Parameters   ##################
x = 300            # Number of points to display

y_range = [0,300]   # Range of possible Y values to display
#y_range = list(np.arange(0, 300))
xs = list(np.arange(0, 300))
ys = [0] * x
plot1.set_ylim(y_range)

###   Create plot line
line, = plot1.plot(xs, ys, color= "yellow")

def plot():
def animate(i, ys):

ys.append(DATA)

#   Limit y list to set number of items
ys = ys[- x:]
#ys = ys(np.arange(0, 300))

#   Update line with new y values
line.set_ydata(ys)
return line,

### Set up plot to call animate() function
ani = animation.FuncAnimation(fig, animate, fargs=(ys,),interval=.0001, blit=True)