# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt from matplotlib import rc import matplotlib.path as mpath fig = plt.figure() ax = fig.add_subplot(221, aspect='auto')#2*2的画布,放在第一个位置 ax.grid(True) # 隐藏网格 ax.grid(False) rc('mathtext', default='regular') star = mpath.Path.unit_regular_star(6) # 星型Path circle = mpath.Path.unit_circle() # 圆形Path # 整合两个路径对象的点 verts = np.concatenate([circle.vertices, star.vertices[::-1, ...]]) # 整合两个路径对象点的类型 codes = np.concatenate([circle.codes, star.codes]) # 根据路径点和点的类型重新生成一个新的Path对象 cut_star = mpath.Path(verts, codes) # 五角星 # rectangle = mpath.Path.unit_rectangle() # 长方形Path # circle = mpath.Path.unit_circle() # 圆形Path # # 整合两个路径对象的点 # rectangle_verts = np.concatenate([circle.vertices, rectangle.vertices[::-1, ...]]) # # 整合两个路径对象点的类型 # rectangle_codes = np.concatenate([circle.codes, rectangle.codes]) # # 根据路径点和点的类型重新生成一个新的Path对象 # rectangle_star = mpath.Path(rectangle_verts, rectangle_codes) # 长方形 layer = ['1', '2', '3', '4'] print(layer) AUC = [0.8624, 0.8838, 0.8859, 0.8881] print(AUC) Logloss = [0.2119, 0.2209, 0.2265, 0.2307] print(Logloss) ax.plot(layer, Logloss, '--r', marker=star, markersize=10, label='Logloss') ax2 = ax.twinx() ax2.plot(layer, AUC, '--b', marker=star, markersize=10, label='AUC') ax.legend(loc="upper left") ax.set_xlabel("number of layer") ax.set_ylabel("Logloss") ax2.set_ylabel("AUC") ax2.set_ylim(0.86, 0.9) ax.set_ylim(0.2, 0.24) ax2.legend(loc=0) plt.savefig('0.png')
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)