gnuplot学习(1)

转自:blog.csdn.net/minpro


在学习NS2仿真的过程中,选用gnuplot来呈现分析结果,如下是gnuplot使用过程中的点滴日记:

--------------------------------------------------------------------------------------------------------------------------------------

2011.3.6

命令过程如下:

# gnuplot

    G N U P L O T
    Version 4.4 patchlevel 2
    last modified Wed Sep 22 12:10:34 PDT 2010
    System: Linux 2.6.35.6-45.fc14.i686

    Copyright (C) 1986-1993, 1998, 2004, 2007-2010
    Thomas Williams, Colin Kelley and many others

    gnuplot home:     http://www.gnuplot.info
    faq, bugs, etc:   type "help seeking-assistance"
    immediate help:   type "help"
    plot window:      hit 'h'

Terminal type set to 'x11'
gnuplot> set term png
Terminal type set to 'png'
Could not find/open font when opening font "arial", using internal non-scalable font
Options are 'nocrop medium size 640,480 '
gnuplot> set term gif
Terminal type set to 'gif'
Could not find/open font when opening font "arial", using internal non-scalable font
Options are 'nocrop medium size 640,480 '
gnuplot> set term

Available terminal types:
           canvas  HTML Canvas object
              cgm  Computer Graphics Metafile
            corel  EPS format for CorelDRAW
           dpu414  Seiko DPU-414 thermal printer [small medium large]
             dumb  ascii art for anything that prints text
              dxf  dxf-file for AutoCad (default size 120x80)
            eepic  EEPIC -- extended LaTeX picture environment
              emf  Enhanced Metafile format
            emtex  LaTeX picture environment with emTeX specials
         epslatex  LaTeX picture environment using graphicx package
     epson_180dpi  Epson LQ-style 180-dot per inch (24 pin) printers
      epson_60dpi  Epson-style 60-dot per inch printers
      epson_lx800  Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...
              fig  FIG graphics language for XFIG graphics editor
              gif  GIF images using libgd and TrueType fonts
             gpic  GPIC -- Produce graphs in groff using the gpic preprocessor
          hp2623A  HP2623A and maybe others
           hp2648  HP2648 and HP2647
           hp500c  HP DeskJet 500c, [75 100 150 300] [rle tiff]
             hpdj  HP DeskJet 500, [75 100 150 300]
             hpgl  HP7475 and relatives [number of pens] [eject]
Press return for more: 
           hpljii  HP Laserjet series II, [75 100 150 300]
             hppj  HP PaintJet and HP3630 [FNT5X9 FNT9X17 FNT13X25]
           imagen  Imagen laser printer
             jpeg  JPEG images using libgd and TrueType fonts
            latex  LaTeX picture environment
               mf  Metafont plotting standard
              mif  Frame maker MIF 3.00 format
               mp  MetaPost plotting standard
          nec_cp6  NEC printer CP6, Epson LQ-800 [monocrome color draft]
          okidata  OKIDATA 320/321 Standard
              pbm  Portable bitmap [small medium large] [monochrome gray color]
             pcl5  HP Designjet 750C, HP Laserjet III/IV, etc. (many options)
         pdfcairo  pdf terminal based on cairo
              png  PNG images using libgd and TrueType fonts
         pngcairo  png terminal based on cairo
       postscript  PostScript graphics, including EPSF embedded files (*.eps)
          pslatex  LaTeX picture environment with PostScript /specials
            pstex  plain TeX with PostScript /specials
         pstricks  LaTeX picture environment with PSTricks macros
              qms  QMS/QUIC Laser printer (also Talaris 1200 and others)
            regis  REGIS graphics language
            starc  Star Color Printer
Press return for more: 
              svg  W3C Scalable Vector Graphics driver
      tandy_60dpi  Tandy DMP-130 series 60-dot per inch graphics
          tek40xx  Tektronix 4010 and others; most TEK emulators
          tek410x  Tektronix 4106, 4107, 4109 and 420X terminals
          texdraw  LaTeX texdraw environment
             tgif  TGIF X11 [mode] [x,y] [dashed] ["font" [fontsize]]
         tkcanvas  Tk/Tcl canvas widget [perltk] [interactive]
             tpic  TPIC -- LaTeX picture environment with tpic /specials
          unknown  Unknown terminal type - not a plotting device
            vttek  VT-like tek40xx terminal emulator
              x11  X11 Window System
             xlib  X11 Window System (gnulib_x11 dump)
            xterm  Xterm Tektronix 4014 Mode

-------------------------------------------------------------------------------------

问题如下:

Terminal type set to 'gif'
Could not find/open font when opening font "arial", using internal non-scalable font
Options are 'nocrop medium size 640,480 '

 

设置终端类型为GIF不成功,所以在使用命令把图像存储成 gif 格式不成功。

设置终端类型为postscript,输出*.eps格式的图像是可以的。

 

-------------------------------------------------------------------------------------

尝试解决办法:

从set term命令的结果可以看到:

png  PNG images using libgd and TrueType fonts

猜想是否缺少libgd和TrueType的支持?

所以,下载了zlib、TrueType和libgd,并安装,结果如下:

# ls
libfreetype.a   libfreetype.so.6      libgd.la    libgd.so.2.0.0  libpng15.so         libpng.a   libz.a     libz.so.1.2.5
libfreetype.la  libfreetype.so.6.6.2  libgd.so    libpng15.a      libpng15.so.15      libpng.la  libz.so    pkgconfig
libfreetype.so  libgd.a               libgd.so.2  libpng15.la     libpng15.so.15.1.0  libpng.so  libz.so.1
但问题依旧存在。

(如上库的安装参考:http://liumin20081128.blog.163.com/blog/static/601960692010103031211956/)

 

另外有一种说法是:gnuplot 4.0移除了对gif的支持,但是我的版本是4.4.2,而且set term命令可以看到gif的相关说明。

其他的参考:

http://gnuplot.sourceforge.net/faq/faq.html#SECTION00091000000000000000

https://bugzilla.redhat.com/show_bug.cgi?id=537960

----------------------------------------------------------------------------------------

linux基础知识参考:

http://www.linuxdiyf.com/viewarticle.php?id=56217

http://www.ibm.com/developerworks/cn/linux/l-gnuplot/index.html?ca=dwcn-newsletter-linuxi

 

------------------------------------------------------------------------------------------

求助:期待高人指导!

 

---------------------------------------------------------------------------------------------

解决办法:
从错误提示可以看出:缺少“arial”的字体支持,这需要安装windows通用字体,下载地址:http://www.my-guides.net/en/images/stories/fedora12/

安装:# rpm -ivh msttcore-fonts-2.0-3.noarch.rpm 
之后,在msttcore的路径下即可找到ariali.ttf,猜想这应该就是所要的字体库了吧!

设置临时环境变量:
# export GDFONTPATH="/usr/share/fonts/msttcore"、
# export GNUPLOT_DEFAULT_GDFONT="arial"

检查环境变量是否设置成功:
# echo $GDFONTPATH
/usr/share/fonts/msttcore
# echo $GNUPLOT_DEFAULT_GDFONT
arial

运行gnuplot:
gnuplot> set term gif
Terminal type set to 'gif'
Options are 'nocrop font arial 12 size 640,480 '
gnuplot> set output "sin.gif"
gnuplot> plot sin(x)
gnuplot> quit

查看sin.gif,ok!

致谢:jiazhen!


  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值