# -*- 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. docker镜像文件的导入与导出(docker镜像迁移)

    1.查看镜像ID # docker images [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE myto ...

  2. NFS应用场景及环境搭建

    两台虚拟机,一台做服务端(server)用来存储,一台做客户端(client)用来访问. 注意,两台虚拟机都已经挂载完光盘,并配置好yum源.客户端client已经安装好lamp环境,服务端不做任何处 ...

  3. Android 使用自定义字体

    整个项目要使用第三方字体首先将字体文件放到assets文件夹下 因为整个项目要用第三方字体这里我重写了 TextView Button EditText 三个控件 以TextView 为例代码如下   ...

  4. css属性—position的使用与页面的分层介绍

    一.引言: 在css众多属性中,position算是里面用的比较多也相对来说比较重要的属性了,它对于单个标签的“定位”.标签之间的“相对位置定位”还有网页的分层来说十分重要! 二.“定位的实现”具体介 ...

  5. static--Android静态变量使用陷阱

     相关资料:http://blog.csdn.net/ctcwri/article/details/8858414                     http://blog.csdn.net/w ...

  6. dspmq dspmqver command not found(dspmq命令找不到,dspmqver主安装目录设置不正确

    [root@rhv6-64b ~]# su - mqm -bash-4.1$ dspmq -bash: dspmq: command not found(dspmq命令找不到) -bash-4.1$ ...

  7. MySQL 开启和查看bin-log日志

    1.5.7版本前修改my.cnf文件,添加log-bin=my-bin(my.cnf的位置根据自己安装的路径查看)# vi /usr/local/mysql/my.cnflog-bin=my-bin  ...

  8. Android--普通注册页面实现(无功能)

    reg.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmln ...

  9. 数据库类型总结对比(Java,Hibernate,SQLServer,MySQL,Oracle)

  10. MySQL-MMM实现MySQL高可用

    一.MMM简介 MMM(Master-Master replication manager for MySQL)是一套支持双主故障切换和双主日常管理的脚本程序.MMM使用Perl语言开发,主要用来监控 ...