# -*- coding: utf-8 -*-
"""
Created on Fri Sep 7 18:38:35 2018 @author: manuel
"""
import matplotlib.pyplot as plt
#from mpl_toolkits.axisartist.axislines import SubplotZero
import numpy as np
plt.rcParams['font.sans-serif']=['SimHei'] # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus']=False # 用来正常显示负号 SAVE_LOSS0='HG_loss.txt'
#SAVE_LOSS1='hotrolledsteel1800_20_20_2000_10_loss.txt'
#SAVE_LOSS2='hotrolledsteel1800_20_20_2000_50_loss.txt'
#SAVE_LOSS3='hotrolledsteel1800_20_20_2000_100_loss.txt'
SAVE_VALIDATION_ACCURACY='HG_validation_accuracy.txt'
#x = np.linspace(0, 2, 100) #plt.plot(x, x, label='linear')
#plt.plot(x, x**2, label='quadratic')
#plt.plot(x, x**3, label='cubic')
with open(SAVE_LOSS0, 'r') as open_file0:
file_string0 = open_file0.read()
file_values0 = [float(x) for x in file_string0.split(',')] with open(SAVE_VALIDATION_ACCURACY, 'r') as open_file1:
file_string1 = open_file1.read()
file_values1 = [float(x) for x in file_string1.split(',')] #with open(SAVE_LOSS2, 'r') as open_file2:
# file_string2 = open_file2.read()
#file_values2 = [float(x) for x in file_string2.split(',')]
#
#with open(SAVE_LOSS3, 'r') as open_file3:
# file_string3 = open_file3.read()
#file_values3 = [float(x) for x in file_string3.split(',')] epoches=[i for i in range(len(file_values0))] #plt.plot(epoches, file_values0, label='2000X5',color='black')#darkgray
#plt.plot(epoches, file_values1, label='2000X10',color='black')
#plt.plot(epoches, file_values2, label='2000X50',color='black')#darkgray
plt.plot(epoches, file_values0,'r-',markersize=1,linewidth=1,label="loss")
plt.plot(epoches, file_values1,'b-',markersize=1,linewidth=1,label="accuracy")
plt.plot(np.linspace(1,1,1000),color='black',linestyle='--')
plt.xlabel("epoches(迭代次数)")
plt.ylabel("Loss/Accuracy(损失值/准确率)")
#plt.xticks(range(0,2000,100)) #fig,ax_y2=plt.subplot()
#ax_c=ax_y2.twiny()
#ax_c.set_ylabel('第二Y轴', color='b')
#ax_c.set_yticklabels(["$0$", r"$\frac{1}{2}\pi$", r"$\pi$", r"$\frac{3}{2}\pi$", r"$2\pi$"])
#plt.ylabel("Validation Accuracy")
#plt.axis([0, 2000, 0, 100])
plt.title("Training dataset(训练集)/Learning Rate=0.015 Batch=64") plt.legend() plt.show() #!!!间隔描点未解决

matplot读取文本文件画图的更多相关文章

  1. python读取文本文件

    1. 读取文本文件 代码: f = open('test.txt', 'r') print f.read() f.seek(0) print f.read(14) f.seek(0) print f. ...

  2. (转) Java读取文本文件中文乱码问题

    http://blog.csdn.net/greenqingqingws/article/details/7395213 最近遇到一个问题,Java读取文本文件(例如csv文件.txt文件等),遇到中 ...

  3. Java读取文本文件中文乱码问题 .转载

    最近遇到一个问题,Java读取文本文件(例如csv文件.txt文件等),遇到中文就变成乱码.读取代码如下: List<String> lines=new ArrayList<Stri ...

  4. Java基础知识强化之网络编程笔记10:TCP之客户端读取文本文件服务器控制台输出

    1. TCP之客户端读取文本文件服务器控制台输出 (1)客户端:(发送数据到服务端) package cn.itcast_10; import java.io.BufferedReader; impo ...

  5. StreamReader 读取文本文件乱码问题

    解决读取文本文件乱码问题.我采取的是读取前先判断文本文件格式. StreamReader sr = new StreamReader(fullfileName, GetFileEncodeType(f ...

  6. python读取文本文件数据

    本文要点刚要: (一)读文本文件格式的数据函数:read_csv,read_table 1.读不同分隔符的文本文件,用参数sep 2.读无字段名(表头)的文本文件 ,用参数names 3.为文本文件制 ...

  7. Java读取文本文件中文乱码问题

    最近遇到一个问题,Java读取文本文件(例如csv文件.txt文件等),遇到中文就变成乱码.读取代码如下: List<String> lines=new ArrayList<Stri ...

  8. C#读取文本文件某一行

    某一时候,我们只会读取文本文件内某一行.怎样读?还是用for或foreach循环?其实操作起来,很简单,先看看文本文件,如果你也想用下面的文档来做测试,你可以在这个链接进行拷贝:<VB.NET提 ...

  9. C++逐行读取文本文件的正确做法

    作者:朱金灿 来源:http://blog.csdn.net/clever101 之前写了一个分析huson日志的控制台程序,其中涉及到C++逐行读取文本文件的做法,代码是这样写的: ifstream ...

随机推荐

  1. ubuntu 安装php 扩展和查看扩展包

    利用ubuntu的软件包下载.安装工具:apt-get 输入下面的命令即可安装 php扩展库mcrypt.curl.gd库.mbstring.simplexml. apt-get install ph ...

  2. MyBatis 接口的使用

    为了简化MyBatis的使用MyBatis的使用,MyBatis提供了接口方式自动化生成调用过程,可以大大简化MyBatis的开发 开发映射文件: <select id="queryO ...

  3. mysql查询优化之二:查询优化器的局限性

    在<mysql查询优化之一:mysql查询优化常用方式>一文中列出了一些优化器常用的优化手段.查询优化器在提供这些特性的同时,也存在一定的局限性,这些局限性往往会随着MySQL版本的升级而 ...

  4. 学习笔记之TensorFlow

    TensorFlow https://www.tensorflow.org/ An open source machine learning framework for everyone Tensor ...

  5. Oracle 故障整理

    #created at 18-10-28 by nod #提示磁盘空间已满 不能登录数据库 18-10-28 [oracle@oracle ~]$ sqlplus / as sysdba SQL*Pl ...

  6. UML类关系:依赖、关联、聚合、组合

    1,依赖关系(Dependency) 单向,表示一个类依赖于另一个类的定义,其中一个类的变化将影响另外一个类,是一种“use a”关系 如果A依赖于B,则B表现为A的局部变量,方法参数,静态方法调用等 ...

  7. bootstrap样式

    图片: <img src="w.jpg" alt="" class="img-rounded"><img src=&quo ...

  8. javaScrip字符串(String)相关

    -----------------------------------------此页只记录前端关于String的东西----------------------------------------- ...

  9. Android短信收发(二)

    接收SMS类,代码如下 //for receive SMS private SmsReceiver mSmsReceiver; @Override protected void onResume() ...

  10. spi and sensor

    http://blog.csdn.net/DroidPhone/article/details/23367051 https://www.kernel.org/doc/html/v4.14/drive ...