import matplotlib.pyplot as plt from random_walk import RandomWalk #make a random walk and plot the points rw = RandomWalk() #we create a random walk and store it in rw rw.fill_walk() plt.scatter(rw.x_values, rw.y_values,c='Red', edgecolors='none', s=10) #c=rw.y_values, cmap=plt.cm.Reds plt.savefig('rw.png', bbox_inches='tight') plt.show()
import matplotlib.pyplot as plt from random_walk import RandomWalk # Cria um passeio aleatório e plota os pontos rw = RandomWalk() # Intancia, cria passeio aletório e o armazena em rw rw.fill_walk() # Plotar o gráfico plt.scatter(rw.x_values, rw.y_values, s=15) plt.show()
import matplotlib.pyplot as plt from random_walk import RandomWalk # Keep making new walks as long as program is active. while True: # Make a random walk. try: how_far = int(input("How many steps do you want to walk? ")) print(f"You walked {str(how_far)} steps.") except ValueError: print("You're walking 5,000 steps.") how_far = 5000 rw = RandomWalk(how_far) rw.fill_walk() # Plot the points in the walk. plt.style.use('classic') fix, ax = plt.subplots() # Emphasize the first and last points. ax.scatter(0, 0, c='green', edgecolors='none', s=100) # Show the path walked. ax.scatter(rw.x_values[-1], rw.y_values[-1], c='red', edgecolors='none', s=100) ax.plot(rw.x_values, rw.y_values, linewidth=1) # Show the title. ax.set_title('Random Path Walked')
from random_walk import RandomWalk import matplotlib.pyplot as plt a_walker = RandomWalk() a_walker.take_a_walk() a_walker.map_walk()
def __init__(self, e, diameter): self.e = e self.d = diameter self.motion = MotionSystem(15, # robot mass, 15kg 0.33, # wheelbase, 330mm 0.08, # wheel_mass, 80 gr 0.024, # wheel_radius, 24mm 400, # kp speed 300, # ki speed x= 0.05, y=0.05, theta= np.radians(90)) #120 self.sensor = [BumpSensor(e, self.motion), None, None, TidalSensor(0.1, e, (0, 0, 0))]#[[Sensor(self.motion, self.e, Dirs.Up), Sensor(self.motion, self.e, Dirs.Right)] # self.absolute_rotation = AbsoluteRotationProportionalControl(self.motion, # 4, # kp # 6) # 6 rad/s max self.absolute_rotation = AbsoluteRotationProfileControl(self.motion, 12, # accel 12 rad/s^2 12, # decel 12 rad/s^2 3) # 6 rad/s max self.relative_rotation = RelativeRotationProportional(self.motion, 10, # 10 rad/s max 20) # kp = 20 self.heading_to = HeadingToControl(self.absolute_rotation) self.polar = PolarControl(self.motion, 5.5, 1, # 1 m/s max # 4, 6, # 6 rad/s max #non bastano 10, 2, # 10 rad/s max #modifichiamo 0.005) # 5 mm self.dummy = DummyControl(self.motion, 5.5, 1, # 1 m/s max # self.sensor[0], #DSensor(0.1, e, (0.05, 0, 0)), DSensor(self.d, e, (self.d/2, 0, 0)), 0.005) # 5 mm ''' self.dwa = DWAControl(self.motion, 5.5, 1, # 1 m/s max 10, 20, # 10 rad/s max # self.motion, 5.5, 1, 10, np.radians(10), 1e-3, r=0.05, threshold=0.01) ''' self.smooth_vw_control = SmoothVWControl(self.motion, 5.5, 1, # 1 m/s max # 10, 20, # 10 rad/s max # self.motion, 5.5, 1, 10, np.radians(10), None, threshold=0.01) self.path_control = PathControl(self.motion, {'rotate': self.absolute_rotation, 'rotate_relative': self.relative_rotation, 'heading_to': self.heading_to, 'go_to': self.polar, 'go': self.dummy, #'dwa': self.dwa }) self.ga_path_control = GA_path_control( "output.txt", self.motion, {'rotate': self.absolute_rotation, 'rotate_relative': self.relative_rotation, 'heading_to': self.heading_to, 'go_to': self.polar, 'go': self.dummy, #'dwa': self.dwa } ) self.random_walk = RandomWalk(self, {'rotate': self.absolute_rotation, 'rotate_relative': self.relative_rotation, 'heading_to': self.heading_to, 'go_to': self.polar, 'go': self.dummy, 'smooth': self.smooth_vw_control }, self.sensor, self.e) self.zig_zag = ZigZag(self, {'rotate': self.absolute_rotation, 'rotate_relative': self.relative_rotation, 'heading_to': self.heading_to, 'go_to': self.polar, 'go': self.dummy, }, self.sensor, self.e) self.boundary_walk = BoundaryWalk(self, {'rotate': self.absolute_rotation, 'rotate_relative': self.relative_rotation, 'heading_to': self.heading_to, 'go_to': self.polar, 'go': self.dummy, }, self.sensor, self.e) self.spiral = Spiral(self, {'rotate': self.absolute_rotation, 'rotate_relative': self.relative_rotation, 'heading_to': self.heading_to, 'go_to': self.polar, 'go': self.dummy, },self.sensor, self.e) self.random_path_control = RandomPathControl([ [self.boundary_walk, 20], [self.zig_zag, 20], [self.random_walk, 30], [self.spiral, 30] ]) self.alignControl = AlignControl(self.motion, TidalSensor(0.1, e, (0, 0, 0)), 100, 10) self.bump = BumpSensor(e, self.motion) # heading_to sembra introdurre un erroe di convergenza. # meglio usare rotazioni relative # self.path_control.add( ( 'heading_to', [0, 1] ) ) a = load_array('output.txt', delimiter=',') r = compress_array(a, 4, 0, 0, True) for cmd in r: self.path_control.add(cmd) #self.path_control.add(('rotate_relative', [0])) #self.path_control.add(('go_to', [0.05, 0.45])) #self.path_control.add(('rotate', [0])) #self.path_control.add(('go_to', [0.35, 0.45])) # self.path_control.add(('dwa', [0.3, 0.3])) # self.path_control.add(('dwa', [0.15, 0.15])) # self.path_control.add(('dwa', [0.05, 0.4])) # self.path_control.add(('go_to', [0, 0.2])) # self.path_control.add(('go_to', [0, 0.3])) # self.path_control.add(('go_to', [0, 0.4])) # self.path_control.add(('go_to', [0, 0.5])) # self.path_control.add(('go_to', [0.4, 0.2])) # self.path_control.add(('heading_to', [0.2, 0.2])) # self.path_control.add(('rotate_relative', [-20])) # self.path_control.add(('rotate_relative', [+40])) # self.path_control.add(('rotate_relative', [-20])) self.telemetry = SpeedTelemetry(self.motion) self.map = MemoryMap(e, self.sensor[3]) #self.start_x, self.start_y, _ = self.get_pose() self.scan_timer = self.scan_timer_time = 1000 #1 sec self.state = 0;
from random_walk import RandomWalk import time import matplotlib.pyplot as plt a_walker = RandomWalk(5000, 2) a_walker.take_a_walk() # a_walker.map_walk()
import matplotlib.pyplot as plt from random_walk import RandomWalk #只要程序活跃就不断的模拟随机漫步 while True: # 创建一个RandomWalk实例, 并将其包含的点都绘制出来 rw = RandomWalk(50000) rw.fill_walk() #生成随机漫步坐标列表 #设置绘图窗口的分辨率与尺寸 plt.figure( dpi=128, figsize=(10, 6)) #生成一个有num_points数目个数的列表 point_numbers = list(range(rw.num_points)) plt.scatter(rw.x_values, rw.y_values, c=point_numbers, cmap=plt.cm.Blues, edgecolor='none', s=1) #绘制散点图,按顺序着色深浅,删除黑色轮廓,大小为10 #突出起点和终点 plt.scatter(0, 0, c='green', edgecolor='none', s=50) plt.scatter(rw.x_values[-1], rw.y_values[-1], c='red', edgecolor='none', s=50) #显示列表中的最后一个点 #隐藏坐标轴 plt.axes().get_xaxis().set_visible(False) plt.axes().get_yaxis().set_visible(False) plt.show() #判断 keep_running = input("Make it running again? (y/n)") #输入语句 if keep_running == 'n': #如果是'n'就结束循环
def learn(self, max_episode): """ the main part of MC which is the process for learning a best epsilon-greedy policy :param max_episode: the maximum of episode number """ episode_num = 0 while True: episode_num += 1 pai = self.epsilon_greedy_policy self.walker.walk(pai) # generate a chain self.visit = [[s, a] for s, a in zip( list(self.walker.chain["S"].values())[:-1], list(self.walker.chain["A"].values()))] T = max(self.walker.chain['S']) g = 0 for t in range(T - 1, -1, -1): g = self.gamma * g + self.walker.chain['R'][t + 1] s_t, a_t = self.walker.chain['S'][t], self.walker.chain['A'][t] if self.is_first_visit(t): self.returns[s_t][a_t].append(g) self.q[s_t][a_t] = sum(self.returns[s_t][a_t]) / len( self.returns[s_t][a_t]) if episode_num >= max_episode: break if __name__ == '__main__': walker = RandomWalk(3) fv_mc = MonteCarlo(walker, 0.5, 0.9) fv_mc.learn(10)
#multiple random walk and styling import matplotlib.pyplot as plt from random_walk import RandomWalk while True: mrw = RandomWalk(50000) #we create a random walk and store it in rw mrw.fill_walk() plt.figure(dpi=128, figsize=(10, 6)) #it control width, height, background, resolution point_number = list(range(mrw.num_points)) plt.scatter(mrw.x_values, mrw.y_values, c=point_number, cmap=plt.cm.Reds, edgecolor='none', s=10) #Emphasis the first and last points plt.scatter(0, 0, c='green', edgecolor='none', s=100) #starting point in Green plt.scatter(mrw.x_values[-1], mrw.y_values[-1], c='red', edgecolors='none', s=100) #ending point in Red plt.savefig('mrw.png', bbox_inches='tight') plt.show() keep_running = input("Make Another walk (Y/N): ") if keep_running == 'n': break
# Ask user at the end of simulation to continue or # to quit program. while True: steps = 32 tests = 20_001 average_distances = [] tot_percentages = [] step_counter = [] for step in range(1, steps): no_transport = 0 sum_distance = 0 for test in range(1, tests): rw = RandomWalk(step) rw.fill_walk() (no_transport, sum_distance) = rw.calculate_distance(no_transport, sum_distance) (average_distances, tot_percentages) = rw.calculate_average( sum_distance, tests, no_transport, average_distances, tot_percentages) step_counter.append(step) rw.plot_walk(step, test, step_counter, average_distances, tot_percentages) # Generate new random walk? keep_running = input("Make another random walk? (y/n): ") if keep_running == "n":
import matplotlib.pyplot as plt from random_walk import RandomWalk # Make a random walk and plot the points while True: walk = RandomWalk(50000) walk.fill_walk() point_numbers = list(range(walk.num_points)) # Set the size of the plot window plt.figure(dpi=128, figsize=(10, 6)) plt.scatter(walk.x_values, walk.y_values, c=point_numbers, cmap=plt.cm.Blues, edgecolors='none', s=1) plt.scatter(0, 0, c='green', edgecolors='none', s=100) plt.scatter(walk.x_values[-1], walk.y_values[-1], c='red', edgecolors='none', s=100) # Remove the axes plt.axes().get_xaxis().set_visible(False) plt.axes().get_yaxis().set_visible(False) plt.show() keep_running = input('Make another walk? (y/n) ') if keep_running.lower() == 'n': break
import matplotlib.pyplot as plt from random_walk import RandomWalk while True: a = RandomWalk(50000) a.fill_walk() point_numbers = list(range(a.num_point)) plt.scatter(a.x_points, a.y_points, s=1, c=point_numbers, cmap=plt.cm.Blues) plt.scatter(0, 0, c='green', s=100) plt.scatter(a.x_points[-1], a.y_points[-1], c='red', s=100) plt.axes().get_xaxis().set_visible(False) plt.axes().get_yaxis().set_visible(False) # plt.figure(figsize=(5, 3)) plt.show() keep_running = input("Make another walk? (y/n): ") if keep_running == 'n': break
# -*- coding: utf-8 -*- """ Created on Tue Mar 3 14:31:31 2020 @author: jwitherspoon """ import pygal from random_walk import RandomWalk rw1 = RandomWalk() rw2 = RandomWalk() rw3 = RandomWalk() rw1.fill_walk() rw2.fill_walk() rw3.fill_walk() xy1 = [i for i in zip(rw1.x_values, rw1.y_values)] xy2 = [i for i in zip(rw2.x_values, rw2.y_values)] xy3 = [i for i in zip(rw3.x_values, rw3.y_values)] scatter_chart = pygal.XY(stroke=False) scatter_chart.title = 'Random Walk' scatter_chart.add('Step1', xy1) scatter_chart.add('Step2', xy2) scatter_chart.add('Step3', xy3) scatter_chart.render_to_file('randomwalk_xy.svg')
from random_walk import RandomWalk #continues creating new walks while the progrem is active while True: #creates a random walk and plot the poits rw = RandomWalk() rw.fill_walk() rw.plot_points() rw.plot_line() keep_running = input('Make another walk? (y/n): ') if keep_running.lower() == 'n': break
Definition q(s,a) = \sum{s',r} p(s',r|s,a)(r + gamma*v(s')) :param s: the current state :param a: the action which is choose under the current state :return: the value of q(s,a) """ s_prime, r = self.env.next_state(s, a) q_val = r + self.gamma*self.v[s_prime] return q_val def get_policy(self): """get the optimality policy""" pai = {} for s in range(self.state_num-1): max_q = 0 max_a = None for a in self.env.action(s): q_val = self.q(s, a) if max_q < q_val: max_q = q_val max_a = a pai[s] = max_a return pai if __name__ == '__main__': env = RandomWalk(5) value_iter = ValueIteration(env, 0.5, 1e-8) value_iter.value_evaluate() best_pai = value_iter.get_policy() env.walk(best_pai)
np.flatnonzero(value_of_action_list == value_of_action_list.max())) for action_iter in range(self.env.action_space.n): if action_iter == optimal_action: self.policies[state][ action_iter] = 1 - epsilon + epsilon / self.env.action_space.n else: self.policies[state][ action_iter] = epsilon / self.env.action_space.n if is_done: break state = new_state if __name__ == '__main__': env = RandomWalk() agent = Agent(env, initial_value=0.0) agent.q_control(100, alpha=0.1, gamma=0.9, only_evaluation=False) value_list = [] ground_truth = [1 / 6, 2 / 6, 3 / 6, 4 / 6, 5 / 6] for state_i in range(env.state_space.n): value = 0 for action_i in range(env.action_space.n): value += \ agent.value_state_action_1[(state_i, action_i)] * \ agent.policies[state_i][action_i] value_list.append(value) print('value of state %d is %f' % (env.state_space[state_i], value)) plt.plot(env.state_space[1:-1], value_list[1:-1], c='b') plt.plot(env.state_space[1:-1], ground_truth, c='r') plt.show()
import matplotlib.pyplot as plt from random_walk import RandomWalk decisions = input("How many choices would you like the walk to make?\n") sizes = input("What size would you like your data points to be?\n") while True: rw = RandomWalk(decisions) rw.fill_walk() plt.figure(figsize=(10, 6)) point_numbers = list(range(int(rw.num_points))) plt.scatter(rw.x_values, rw.y_values, c=point_numbers, cmap=plt.cm.Greens, edgecolor='none', s=int(sizes)) plt.scatter(0, 0, c='red') plt.scatter(rw.x_values[-1], rw.y_values[-1], c='red') plt.axes().get_xaxis().set_visible(False) plt.axes().get_yaxis().set_visible(False) plt.show() keep_running = input("Make another walk with " + decisions + " decisions and " + sizes + " size points?(y/n): ")
import matplotlib.pyplot as plt from statistics import median from random_walk import RandomWalk while True: #keep making new walks as long as the program is active #make a random walk and plot the points rw = RandomWalk( 10000 ) #the input here is basically running the class with this number of points since it #is feeding the 'point numbers' attribute for the class rw.fill_walk(rw.get_step) point_numbers = list( range(rw.num_points) ) #make a list from 0-the number of points we set in the call to the class plt.scatter(rw.x_values, rw.y_values, c=point_numbers, cmap=plt.cm.Reds, s=5) #we plot the scatter points and we use #the 'point number' to gradually darken the scatter as the number of points plotted increases to show the path of the walk #settings for the axes and title of graph plt.title('Random Walk', fontsize=14) plt.xlabel('X Values', fontsize=10) plt.ylabel('Y Values', fontsize=10) #this is to hide the axes to get a pure view of our scatter #plt.axes().get_xaxis().set_visible(False) #plt.axes().get_yaxis().set_visible(False)
import sys import numpy as np import matplotlib.pyplot as plt from random_walk import RandomWalk from random_args_parser import RandomArgsParser from matplotlib.animation import FuncAnimation #if '-p' in sys.argv: #import cProfile anim_count = 0 fig, ax = plt.subplots() xdata, ydata = [], [] ln, = plt.plot([], [], 'r', animated=True) rwalk = RandomWalk() rwalk.array_size = 10000 rwalk.dim_size = 2 rwalk.gen_dwalk() def init(): global rwalk ax.set_xlim(np.nanmin(rwalk.dim_array[0]), np.nanmax(rwalk.dim_array[0])) ax.set_ylim(np.nanmin(rwalk.dim_array[1]), np.nanmax(rwalk.dim_array[1])) return ln, def update(frame): global anim_count xdata.append(rwalk.dim_array[0][anim_count])
import matplotlib.pyplot as plot from random_walk import RandomWalk while True: rw = RandomWalk(50000) rw.fill() plot.style.use("classic") fig, ax = plot.subplots(figsize=(15, 9)) point_numbers = range(rw.num_points) ax.scatter(rw.x_values, rw.y_values, c=point_numbers, cmap=plot.cm.Blues, edgecolors="none", s=1) ax.scatter(0, 0, c="green", edgecolors="none", s=100) ax.scatter(rw.x_values[-1], rw.y_values[-1], c="red", edgecolors="none", s=100) ax.get_xaxis().set_visible(False) ax.get_yaxis().set_visible(False) plot.show() keep_running = input("Make another walk? (y/n): ") if keep_running == "n": break
import matplotlib.pyplot as plt from random_walk import RandomWalk while True: rw = RandomWalk(50000) #rw is a instance(means case) of this class #equal rw=RandomWalk() then rw.num_points=50000 rw.fill_walk() point_numbers = list(range(rw.num_points)) plt.scatter(rw.x_values, rw.y_values, c=point_numbers, cmap=plt.cm.Blues, edgecolor='none', s=1) plt.scatter(0, 0, c='green', edgecolors='none', s=10) plt.scatter(rw.x_values[-1], rw.y_values[-1], c='red', edgecolors='none', s=10) plt.axes().get_xaxis().set_visible(False) plt.axes().get_yaxis().set_visible(False) plt.show() keep_running = input('make another wakl?(y/n):') if keep_running == 'n':
import matplotlib.pyplot as plt from random_walk import RandomWalk while True: randomwalk = RandomWalk(30000) fig, ax = plt.subplots() randomwalk.walk() xcoordinates = randomwalk.x ycoordinates = randomwalk.y num_points = range(randomwalk.num_points) ax.scatter(xcoordinates, ycoordinates, c=num_points, cmap=plt.cm.Blues, edgecolors='none', s=1) ax.get_xaxis().set_visible(False) ax.get_yaxis().set_visible(False) plt.show() prompt = input('Want to walk more? (y/n)') if prompt == 'n' or prompt == 'N': break
# animate img.set_array(state_t_1) plt.axis("off") return img, if __name__ == "__main__": # args parser = argparse.ArgumentParser() parser.add_argument("-m", "--model_path") parser.add_argument("-s", "--save", dest="save", action="store_true") parser.set_defaults(save=False) args = parser.parse_args() # environmet, agent env = RandomWalk() agent = DQNAgent_RandomWalk(env.enable_actions, env.name) agent.load_model(args.model_path) # variables state_t_1, reward_t = env.observe() # animate fig = plt.figure(figsize=(env.screen_n_rows / 2, env.screen_n_cols / 2)) fig.canvas.set_window_title("{}-{}".format(env.name, agent.name)) img = plt.imshow(state_t_1, interpolation="none", cmap="gray") ani = animation.FuncAnimation(fig, animate, init_func=init, blit=True) if args.save: # save animation (requires ImageMagick) ani_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
#coding=utf-8 import matplotlib.pyplot as plt from random_walk import RandomWalk # 只要程序处于活动状态,就不断地布朗运动 while True: # 创建一个RandomWalk实例,并将其包含的点都绘制出来 rw = RandomWalk(5000) rw.direction_choice = [-1, 1] rw.distance_choice = list(range(0, 9)) rw.fill_walk() # 设置绘图窗口尺寸 plt.figure(dpi=100, figsize=(19.24, 10.8)) line_width = 2 plt.plot(rw.x_values, rw.y_values, linewidth=line_width) # 隐藏坐标轴 plt.axes().get_xaxis().set_visible(False) plt.axes().get_yaxis().set_visible(False) plt.show() keep_running = input("Make another walk? (y/n): ") if keep_running == "n": break
import pygal from random_walk import RandomWalk randomWalk = RandomWalk() randomWalk.walk() x = randomWalk.x y = randomWalk.y length = len(x) #实例化一个Bar类 hist = pygal.XY(stroke = False) point = [(x[index],y[index]) for index in range(length)] hist.add("point",point) hist.title ="Random Walk" hist.render_to_file("walk.svg") # 初学者可能会使用如下方法使用字典,这样做忽视了字典中key值唯一不重复的特性,丢失了很多点 # # # 创建坐标点字典 # point = {} # for i in range(rw.num_points): # point[rw.x_values[i]] = rw.y_values[i] # # 列表解析 key,value迭代 # xy_chart.add('A', [(x, y) for x, y in point.items()]) # 以下代码同一key值对应多个value值,不存在丢失点的情况 # # from collections import OrderedDict # # # 创建坐标点字典 # point = OrderedDict() # for i in range(rw.num_points):
import matplotlib.pyplot as plt from random_walk import RandomWalk while True: # Make a random walk instance & fill in its trajectory. rw = RandomWalk(5000) # use 5K points, instead of 50K default rw.fill_walk() point_numbers = list(range(rw.num_points)) plt.plot(rw.x_values, rw.y_values, linewidth=2) plt.scatter(rw.x_values[0], rw.y_values[0], color='green', s=100) plt.scatter(rw.x_values[-1], rw.y_values[-1], color='red', s=100) plt.show() # Ask if user wants a new plot keep_running = input("Make another random path? (y/n): ") if keep_running == 'n': break
import matplotlib.pyplot as plt from random_walk import RandomWalk while True: #make a random walk and plot the points rw = RandomWalk(10000) rw.fill_walk() # set the size of the plotting window plt.figure(dpi=128, figsize=(10, 6)) """ generate a list of numbers equal to the number of points in the walk""" point_numbers = list(range(rw.num_points)) plt.scatter(rw.x_values, rw.y_values, c=point_numbers, cmap=plt.cm.Blues, s=0.5, alpha=1) # emphasize the last and last points plt.scatter(0, 0, c='green', edgecolors='none', s=15) plt.scatter(rw.x_values[-1], rw.y_values[-1], c='red', edgecolors='none', s=15) # remove the axes
import matplotlib.pyplot as plt from random_walk import RandomWalk # make a random walk, and plot the points # keep making new walks, as long as the program is active. while True: # make a random walk, and plot the points. rw = RandomWalk(num_points=5000) rw.fill_walk() # set the size of the plotting window. # figure size in inches plt.figure(figsize=(10, 6), dpi=(100)) point_numbers = list(range(rw.num_points)) plt.plot(rw.x_value, rw.y_value, linewidth=1) # emphasize the first and last points plt.scatter(0, 0, c="green", edgecolors="none", s=50) plt.scatter(rw.x_value[-1], rw.y_value[-1], c="red", edgecolors="none", s=50) # remove the axes plt.axes().get_xaxis().set_visible(False) plt.axes().get_yaxis().set_visible(False)
from random_walk import RandomWalk import pygal # Tworzenie nowego błądzenia losowego, dopóki program pozostaje aktywny. rw = RandomWalk(500) rw.fill_walk() # Wizualizacja wyników. hist = pygal.Bar() hist.force_uri_protocol = 'http' hist.title = "Błądzenie losowe." hist.x_labels = [str(x) for x in rw.x_values] hist.x_title = "Wynik" hist.y_title = "Częstotliwość występowania wartości" hist.add('RW', rw.y_values) hist.render_to_file('rw_v.svg')
import matplotlib.pyplot as plt from random_walk import RandomWalk #创建一个RandomWalk实例 rw = RandomWalk(); rw.fill_walk(); point_numbers = list(range(rw.num_points)) plt.scatter(rw.x_values,rw.y_values,c=point_numbers,cmap=plt.cm.Blues,edgecolors='none',s=10); plt.show();