Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terminal "png" missing when using Gnuplot

Tags:

linux

png

gnuplot

I'm using Xubuntu 13.10 and I installed gnuplot by compiling it manully. However, when I test the feature of "plot" it got an error:

$ python PlotSccDistr.py                            

set terminal png size 1000,800
             ^
"scc.example.plt", line 16: unknown or ambiguous terminal type; type just 'set terminal' for a list

and if I want to set terminal png, but I found no "png" in my list:

$ gnuplot

    G N U P L O T
    Version 4.6 patchlevel 5    last modified February 2014
    Build System: Linux x86_64

    Copyright (C) 1986-1993, 1998, 2004, 2007-2014
    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 terminal

       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
         gpic  GPIC -- Produce graphs in groff using the gpic preprocessor
      hp2623A  HP2623A and maybe others
       hp2648  HP2648 and HP2647
         hpgl  HP7475 and relatives [number of pens] [eject]
       imagen  Imagen laser printer
        latex  LaTeX picture environment
           mf  Metafont plotting standard
          mif  Frame maker MIF 3.00 format
           mp  MetaPost plotting standard
         pcl5  HP Designjet 750C, HP Laserjet III/IV, etc. (many options)
   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
          svg  W3C Scalable Vector Graphics driver
      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

Anyone could help me with that? Thanks!!!

like image 736
Destec Avatar asked Apr 02 '14 15:04

Destec


3 Answers

The reason the png terminal is not available is that it's a libgd-based terminal along with jpeg, and gif. For these terminals gnuplot requires libgd version >= 2.0. In order to get it available you have to install GD Graphics Library first:

$ sudo apt-get install libgd2-dev

Then install gnuplot and check that the png terminal is present:

gnuplot> set terminal

Available terminal types:
              ...
              gif  GIF images using libgd and TrueType fonts
              ...
             jpeg  JPEG images using libgd and TrueType fonts
              ...
              png  PNG images using libgd and TrueType fonts
              ...
like image 103
Boris Avatar answered Oct 06 '22 10:10

Boris


I installed gnuplot5.2.2 on Linux mint (based in ubuntu 16.04) and managed to get the png in the set terminal.

I installed this libraries.

sudo apt-get install libcairo2-dev libpango1.0-dev libgd-dev

Afterwards I re-ran ./configure then make, make check and make install.

While reading the output of ./configure It seems that cairo was indeed necessary, as mentionned by https://stackoverflow.com/users/2604213/christoph above in the comments of the question.

Here's the configuration summary after running ./configure

** Configuration summary for gnuplot 5.2.2:

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 pdf and png terminals: yes 
  lua/TikZ terminal: no 
  wxt terminal: yes 
  Qt terminal: no (use --with-qt or --with-qt=qt4 to enable
like image 45
3nrique0 Avatar answered Oct 06 '22 09:10

3nrique0


What worked for me to get the PNG terminal was typing sudo apt-get install libgd2-noxpm-dev then re-compiling and re-installing gnuplot.

like image 28
Max Avatar answered Oct 06 '22 09:10

Max