Python Matplotlib図面例

396 ワード

import numpy
import matplotlib.pyplot as pyplot

def draw_fig():

    count = 100
    xArr = [i for i in range(count)]
    yArr = numpy.random.random(count)

    pyplot.axes(xlim=(0, count), ylim=(0, 1))
    pyplot.plot(xArr, yArr, color="b")

    pyplot.xlabel("x")
    pyplot.ylabel("y")

    pyplot.savefig("myfig.png")
    pyplot.clf()