Real-time plotting in Python and Matlab
来源:互联网 发布:linux file 文件类型 编辑:程序博客网 时间:2024/05/29 16:51
Python:
import matplotlib.pyplot as pltimport numpy as npplt.ion() ## Note this correctionfig=plt.figure()#plt.axis([0,1000,0,1])i=0x=list()y=list()while i <1000: temp_y=np.random.random(); x.append(i); y.append(temp_y); plt.plot(x,y,'r-'); i+=1; plt.show() plt.pause(0.0001) #Note this correction
方法2:
#coding=gbkimport numpy as npimport matplotlib.pyplot as pltimport scipy.io as sio # loadmatimport numpy as npimport matplotlib.pyplot as plt#plt.axis([0, 10000, 0, 1])plt.ion()y_last = 0for i in range(10000): y = np.random.random() #plt.scatter(i, y) plt.plot([i-1,i],[y_last,y],'r-') plt.pause(0.00001) y_last = y
Matlab:
hold onlast_y = 0;i = 1;while i<1000 %画loss折线图 new_y = rand(1); x = [i-1,i]; y = [last_y new_y]; plot(x,y,'r-'); drawnow ; last_y = new_y; i = i + 1;end
用法,在caffe的训练过程中,我们想通过图的形式实时的显示出损失值或精度。
参考文献:
http://www.suchcode.com/topic/29850/%20%E5%9C%A8matplotlib%E7%9A%84while%E5%BE%AA%E7%8E%AF%E4%B8%AD%E5%AE%9E%E6%97%B6%E7%BB%98%E5%9B%BE
阅读全文
0 0
- Real-time plotting in Python and Matlab
- Concurrent and Real-Time Programming in Java
- Concurrent and Real-Time Programming in Ada
- Scheduling in Real-Time Systems
- Date and Time Representation in Python
- Date and Time Representation in Python
- Previewing and plotting a single sheet in AutoCAD using .NET
- Previewing and plotting multiple sheets in AutoCAD using .NET
- 3D Videocommunication : Algorithms, concepts and real-time systems in human centred communication
- DynamicFusion: Reconstruction and Tracking of Non-rigid scenes in real-time
- UNIX环境中Real time, User time and Sys time
- UNIX环境中Real time, User time and Sys time
- UNIX环境中Real time, User time and Sys time
- UNIX环境中Real time, User time and Sys time
- Cloudera Impala: Real-Time Queries in Apache Hadoop, For Real
- round() Function in Python and Matlab
- real-time scheduler in xen--sedf
- Clock Synchronization in Distributed Real Time Systems
- 看完嵌入式培训视频的一些感受
- oracl面试题
- 导出Excel
- H5游戏的跨平台优点
- jstl中关于fmt:parseDate和fmt:formatDate
- Real-time plotting in Python and Matlab
- JavaFX实现自定义“表单验证工具类”,简化对控件TextField、PassWordField、TextArea添加验证时的代码
- Introduction to Consul
- 变长数组
- java编程思想阅读笔记(一)
- 微信“看一看”,“搜一搜”算法大揭秘
- 图片上传预览
- java枚举与.net中的枚举区别
- ffmpeg一些视频压缩命令