import matplotlib.pyplot as plt from random_walk import RandomWalk #RandWalkインスタンスを作成し、そこに含まれるすべてのポイントをプロットします rw = RandomWalk() rw.fill_walk() plt.scatter(rw.x_values、rw.y_values、c = rw.y_values、 cmap = plt.cm.Blues、edgecolors = "none"、s = 15) plt.show() while True: rw = RandomWalk() rw.fill_walk() plt.scatter(rw.x_values、rw。y_values、c = rw.y_values、cmap = plt.cm.Blues、edgecolors = "none"、s = 15) plt.show() keep_running = input( "Make another walk?(y / n):") if keep_running == "n ": break " "" Color the points "" " while True: rw = RandomWalk() rw.fill_walk() point_numbers = list(range(rw.num_points)) #カラーマッピングを使用して、ウォーク内のポイントの順序を示し、黒い輪郭を削除しますy plt.scatter(rw.x_values、rw.y_values、c = point_numbers、cmap =plt。cm.Blues、edgecolors = "none"、s = 15) plt.show() keep_running = input( "Make another walk?(y / n):") if keep_running == "n": break "" "開始点と終了点" "" while True: 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 = 15) #開始点と終了点を 強調表示しますplt.scatter(0,0、c = "green"、edgecolors = "none"、s = 100) 強調表示しますplt.scatter(rw.x_values [-1]、rw.y_values [-1]、c = "red"、 edgecolors = "none"、s = 100) plt.show() keep_running = input( "Make another walk?(y / n) : ") if keep_running ==" n ": break " ""隐藏坐PWM轴 "" " while True: rw = RandomWalk() rw.fill_walk() plt.scatter(rw.x_values、rw.y_values、c =" red "、edgecolors =" none "、s = 100) #修改坐✓轴的=表示置換修正False 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 "" "ポイントの数を増やす "" " #num_pointsを50000に増やし、より多くのデータを提供します rw = RandomWalk(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、edgecolors = "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.show() "" "画面に合わせてサイズを調整" "" rw = RandomWalk() rw.fill_walk() #figure()関数を使用して幅を指定しますグラフの高さと解像度、解像度と背景色 #描画ウィンドウのサイズを表すfigsizeのタプルをインチで指定します。 #dpiは、plt.figure(dpi = 128、figsize =(10,6)などの解像度を示します。)) plt.figure(figsize =(10,6)) 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 = 1) plt.show()
rw_visual
おすすめ
転載: blog.csdn.net/wyzworld/article/details/88245045
おすすめ
ランキング