Gnuplot:安装与使用备忘

异常信息

问题起源于 signalp-4.1 调用 gnuplot 进行画图,在画图的时候提示不支持 png 格式结果:

$ gnuplot

        G N U P L O T
        Version 5.0 patchlevel 0    last modified 2015-01-01

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

        gnuplot home:     http://www.gnuplot.info
        faq, bugs, etc:   type "help FAQ"
        immediate help:   type "help"  (plot window: hit 'h')

Terminal type set to 'x11'
gnuplot> set term png font "Helvetica,12"  # 您必须在绘图前设置终端和输出文件名
Terminal type set to 'unknown'
                  ^
         unknown or ambiguous terminal type; type just 'set terminal' for a list

gnuplot> set term png font "Helvetica,12";
Terminal type set to 'unknown'
                  ^
         unknown or ambiguous terminal type; type just 'set terminal' for a list

gnuplot> set terminal # 查看 gnuplot 支持的设置格式

Available terminal types:
           canvas  HTML Canvas object
              cgm  Computer Graphics Metafile
          context  ConTeXt with MetaFun (for PDF documents)
            corel  EPS format for CorelDRAW
             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
              fig  FIG graphics language for XFIG graphics editor
             hpgl  HP7475 and relatives [number of pens] [eject]
            latex  LaTeX picture environment
               mf  Metafont plotting standard
               mp  MetaPost plotting standard
             pcl5  HP Designjet 750C, HP Laserjet III/IV, etc. (many options)
             ......

因此考虑重装 gnuplot,以支持 png, jpeg, and gif terminals,具体步骤如下。

安装 GD library 库

GD (https://github.com/libgd/libgd)是一个用于程序员动态创建和处理图像的开源库。手动安装步骤如下。

$ curl -LjO https://github.com/libgd/libgd/releases/download/gd-2.2.5/libgd-2.2.5.tar.gz
$ tar zvxf libgd-2.2.5.tar.gz
$ cd libgd-2.2.5
$ ./configure --prefix=/Bioinfo/SoftWare/libgd-2.2.5
$ make 
$ make install

安装 Gnuplot
官网:http://www.gnuplot.info/
注意:
1
configure 时需要把前一步安装好的 libgd 加进去;
2
make install 如遇一下类似 Permission denied, 可忽略,不影响使用。

$ wget http://ftp.cstug.cz/pub/CTAN/graphics/gnuplot/5.2.6/gnuplot-5.2.6.tar.gz
$ tar zvxf gnuplot-5.2.6.tar.gz
$ cd gnuplot-5.2.6
$ ./configure --prefix=/Bioinfo/SoftWare/gnuplot-5.2.6 --with-gd=/Bioinfo/SoftWare/libgd-2.2.5 LDFLAGS="-L/Bioinfo//SoftWare/libgd-2.2.5/lib" CPPFLAGS="-I/Bioinfo/SoftWare/libgd-2.2.5/include" 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
......
** Configuration summary for gnuplot 5.2.6:

gnuplot will be compiled with the following terminals:

  Standalone terminals: yes (always builtin)
    canvas, cgm, context, dumb, dxf, eepic, emf, emtex,
    epslatex, fig, hpgl, latex, metafont, metapost, mif, pcl5,
    postscript, pslatex, pstex, pstricks, qms, svg,
    tek40xx, tek410x, texdraw, tgif, tkcanvas, tpic, vttek

  dot-matrix terminals: no (use --with-bitmap-terminals to enable)
    epson, nec, okidata, tandy, and seiko dp414 printers
    hp500c, hpdj, hpljii, hppj, pbm, sixel, starc

  X Window System terminal: yes
    (with multi-byte fonts)
    (enable plotting to windows opened by external apps)
    (with application defaults, in /etc/X11/app-defaults/)
  linux terminal (vga console): no (use --with-linux-vga to enable)
  vgagl terminal ((s)vga console): no (use --with-linux-vga to enable)
  ggi terminal: no (use --with-ggi to enable, requires libggi)
  gpic terminal: no   (use --with-gpic to enable)
  mif terminal: no   (use --with-mif to enable)
  caca terminal: no (use --with-caca to enable)
  aqua terminal (OSX): no
  libgd-based png, jpeg, and gif terminals: yes (with animated gif)
  cairo-based terminals: no (requires cairo>=1.2, pango>=1.22, glib>=2.28)
  lua/TikZ terminal: no
  wxt terminal: no (requires C++, wxWidgets>2.6, cairo>0.9, pango>1.22)
  Qt terminal: yes (qt4)

  Additional platform-specific or older terminals omitted by default:
   gpic, mif (FrameMaker 3), hp2623a, hp2648, imagen, kyocera
   pm (makefile.os2), be (BeOS), svga (MSDOS/djgpp)
   windows (several options)

gnuplot will be compiled with the following configurable features:

  Mouse support in interactive terminals: yes
  Typing <space> in plot window raises console
  Placement of rectangles and other objects: yes
  Readline library: GNU readline library with  -lncurses
  Command-line history file: yes
  Check current directory for .gnuplot file: no (use --with-cwdrc to enable)
  Sort help/subtopic tables by column: no (use --without-row-help to enable)
  cerf() and other special functions: no (libcerf not found)
  plugin support for loading external functions: yes
  Use TeX kpsexpand to search for fonts: no (use --with-kpsexpand to enable)
  Hidden3d optimization (gridbox/quadtree/none): quadtree
  Allow deprecated syntax: no (use --enable-backwards-compatibility)
  Statistical summary of data ("stats" command): yes
......
$ make
$ make install 
# 如遇一下 Permission denied, 可忽略,不影响使用
......
make[3]: Nothing to be done for `install-exec-am'.
 /bin/mkdir -p '/Bioinfo/APPS/texlive/texmf-local/tex/latex/gnuplot'
/bin/mkdir: cannot create directory `/Bioinfo/APPS/texlive/texmf-local/tex/latex/gnuplot': Permission denied
make[3]: *** [install-texDATA] Error 1
make[3]: Leaving directory `/Bioinfo/Pipeline/src/pkgs/gnuplot-5.2.6/share/LaTeX'
make[2]: *** [install-am] Error 2
make[2]: Leaving directory `/Bioinfo/Pipeline/src/pkgs/gnuplot-5.2.6/share/LaTeX'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/Bioinfo/Pipeline/src/pkgs/gnuplot-5.2.6/share'
make: *** [install-recursive] Error 1

在这里插入图片描述
注意:configure 的提示(libgd-based png, jpeg, and gif terminals: yes)

  1. 集群运行时,如遇上以下报错,执行一下ldd /Bioinfo/SoftWare/gnuplot-5.2.6/bin/gnuplot,把缺失的对应指向的 libQt*.so 拷贝到一个指定目录,然后增加一个export LD_LIBRARY_PATH=/Bioinfo/SoftWare/gnuplot-5.2.6/customlib:$LD_LIBRARY_PATH即可。
gnuplot: error while loading shared libraries: libQtNetwork.so.4: cannot open shared object file: No such file or directory

在这里插入图片描述

简单绘图

安装完成后,进入 gnuplot 简单画图并保存为 plot.png。

gnuplot> set term png font "Helvetica,12"

Terminal type is now 'png'
Options are 'nocrop enhanced size 640,480 font "Helvetica,12.0" '
gnuplot> set output "plot.png"
gnuplot> plot sin(x)
gnuplot> exit

在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程皮

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值