vendredi 18 septembre 2020

Add list to Matplotlib

What am doing an randomly generated world and Im staring of with basic graph trying to be simular to Perlin Noise. I did everything and last thing that I've writter (important one) did work.

import math
import random
import matplotlib.pyplot as plt

print('ur seed')
a = input()
seed = int(a)
b = (math.cos(seed) * 100)
c = round(b)
#print(c)
for i in range(10):
 z = (random.randint(-1, 2))
 change = (z + c)
 gener = []
 gener.append(change)
 time = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 #print(gener)

 #print(change)
 plt.ylabel('generated')
 plt.xlabel('time')
 #Here I wanna add them to the graph and it is Erroring a lot
 plt.scatter(time, gener)
 plt.title('graph')
 plt.show()



Aucun commentaire:

Enregistrer un commentaire