python_realtime_graph - 8BitsCoding/RobotMentor GitHub Wiki

이미지

import numpy as np
import matplotlib.pyplot as plt
from drawnow import drawnow

def make_fig():
    plt.bar(x, y)
    #plt.scatter(x, y)

plt.axis([0, 10, 0, 1])

x = list()
y = list()

for i in range(10):
    x.append(i)
    y.append(np.random.random())

    plt.bar(x, y)
    drawnow(make_fig)


plt.show()