import matplotlib.pyplot as plt import numpy as np from matplotlib.font_manager import FontProperties font = FontProperties(fname=r"c:\windows\fonts\SimSun.ttc", size=16) def ReadTxtName(rootdir): lines = [] with open(rootdir, 'r') as file_to_read: while True: line = file_to_read.readline() if not line: break line = line.strip('\n') lines.append(float(line)) return lines resultpath = r'C:\Users\411\Desktop\loss\pspnetloss.txt' #四个网络loss值 resultpath2 = r'C:\Users\411\Desktop\loss\segnetloss.txt' resultpath3 = r'C:\Users\411\Desktop\loss\unetloss.txt' resultpath4= r'C:\Users\411\Desktop\loss\修改loss.txt' lineslist = ReadTxtName(resultpath) lineslist2 = ReadTxtName(resultpath2) lineslist3 = ReadTxtName(resultpath3) lineslist4 = ReadTxtName(resultpath4) x=range(0,100) #100 y1=li