回覆列表
  • 1 # 範閒不是我

    # encoding=utf-8

    import matplotlib.pyplot as plt

    from pylab import * #支援中文

    mpl.rcParams["font.sans-serif"] = ["SimHei"]

    names = ["5", "10", "15", "20", "25"]

    x = range(len(names))

    y = [0.855, 0.84, 0.835, 0.815, 0.81]

    y1=[0.86,0.85,0.853,0.849,0.83]

    #plt.plot(x, y, "ro-")

    #plt.plot(x, y1, "bo-")

    #pl.xlim(-1, 11) # 限定橫軸的範圍

    #pl.ylim(-1, 110) # 限定縱軸的範圍

    plt.plot(x, y, marker="o", mec="r", mfc="w",label=u"y=x^2曲線圖")

    plt.plot(x, y1, marker="*", ms=10,label=u"y=x^3曲線圖")

    plt.legend() # 讓圖例生效

    plt.xticks(x, names, rotation=45)

    plt.margins(0)

    plt.subplots_adjust(bottom=0.15)

    plt.xlabel(u"time(s)鄰居") #X軸標籤

    plt.ylabel("RMSE") #Y軸標籤

    plt.title("A simple plot") #標題

    plt.show()

  • 中秋節和大豐收的關聯?
  • SK2的面霜好用嗎?