Welcome 微信登录

首页 / 操作系统 / Linux / Ubuntu下应用Gnuplot进行数据的可视化

GNU/Linux提供了进行数据可视化的很多开源解决方案。 这些解决方案不仅能将数据转换成示意图,图表和特定的图像,还能对数据进行过滤和精简以使其更加有用。Gnuplot是最古老的可视化程序之一,也是最好用的。今天在《GNU/LINUX环境编程》中看到了,学习了一下,以下就做个学习笔记吧。1,安装Gnuplot如果你的电脑里没有Gnuplot , 可以用以下的命令安装:
  1. sudo apt-get install gnuplot</span>  
安装完了之后,用命令:gnuplot进入其界面。
2,简单绘图用命令: >plot  sin(x)就可以很轻松地画出sin(x)的图像,这一点很像MATLAB的plot的用法。也可以通过set 来修改图像的一些参数,程序如下:
  1. set title "Simple Funcrion Plot"  
  2. set xrange [-3 : 3]  
  3. set yrange [-1 : 1]  
  4. set xlabel  "theta"  
  5. set ylabel "sin(theta)"  
  6. set label "sin(0.0)" at 0.0 , 0.0  
  7. plot sin(x)  
运行结果如下:

3, 3-D画图 将数据图像保存到文件
  1. set title "A Simple Function to splot"    /*标题*/  
  2. set xrange [-4:4]        /*x轴的范围*/  
  3. set yrange [-4:4]        /*y轴的范围*/  
  4. set ylabel "Y-AXES"        /*X轴标记*/  
  5. set xlabel "X-AXES"        /*Y轴标记*/  
  6. set isosample 40        /*设置图像的栅格线密度,即作图的采样密度*/  
  7. set hidden                 /*隐线消除*/  
  8. set terminal png          /*terminal控制输出格式,文件的输出格式*/  
  9. set output "plot.png"        /*指定图像的输出名*/  
  10. splot  sin(x)*cos(y)         /*splot 3-D作图函数*/

4,多图模式
  1. /* 
  2. 多图模式,利用layout函数进行分块,类似于:subplot 
  3. */  
  4. set multiplot layout 1 ,2 rowsfirst title "Example Multiplot"  
  5. set title "Top"  
  6. set hidden  
  7. set isosample 40  
  8. splot [x=-4:4] [y=-4:4] sin(x)*cos(y)  
  9.   
  10. set title "Down"  
  11. set hidden   
  12. set isosample 10  
  13. set xrange [-3 : 3]  
  14. set yrange [-1 : 1]  
  15. set xlabel "X"  
  16. set ylabel "sin(X)"  
  17. plot sin(x)
RHEL ES6 通过yum update自动升级Ubuntu 11.10下Spring STS 安装到 Eclipse 3.7.1相关资讯      Ubuntu基础教程  Gnuplot 
  • 如何在Ubuntu中添加和删除书签  (10/08/2015 11:51:26)
  • 如何通过简单的3步恢复Windows 7同  (03/29/2015 16:50:03)
  • 图形绘制利器:Gnuplot  (11/26/2014 07:49:49)
  • 如何在 Ubuntu 中再次登录时还原上  (04/20/2015 21:02:23)
  • 让你玩转 Ubuntu 桌面的十一件武器  (03/11/2015 09:30:49)
  • Ubuntu下安装Gnuplot 4.6.0  (09/07/2014 13:28:21)
本文评论 查看全部评论 (0)
表情: 姓名: 字数