OpenCores
URL https://opencores.org/ocsvn/pdp1/pdp1/trunk

Subversion Repositories pdp1

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /pdp1/trunk
    from Rev 10 to Rev 11
    Reverse comparison

Rev 10 → Rev 11

/sw/xyplot.py
0,0 → 1,43
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.animation as animation
from random import randint
 
width=1024
height=1024
 
def generator():
while True:
x = randint(0,width-1)
y = randint(0,height-1)
yield (x,y)
 
def init():
return [im]
 
def run(point):
# TODO: This doesn't update the image?
fb = im.get_array()
fb *= 0.99 # decay
if point: # plot new point
#print point
x,y=point
fb[y,x]=1.0
im.set_array(fb)
return [im]
 
fig,ax = plt.subplots()
# TODO: this is white to green, want black to green?
cmap = plt.get_cmap("Greens")
#ax.axis('off')
fb = np.ndarray((width,height), np.float32)
fb.fill(0)
#for x in range(width):
# fb[x,:] *= x/float(width)
#print fb
im = ax.imshow(fb, cmap, colors.Normalize(0,1))
 
ani = animation.FuncAnimation(fig, run, generator, interval=1)
plt.show()
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.