Ubuntu – GNUPlot: Terminal set unknown

gnuplot

    G N U P L O T
    Version 4.6 patchlevel 4    last modified 2013-10-02 
    Build System: Linux x86_64

    Copyright (C) 1986-1993, 1998, 2004, 2007-2013
    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 'unknown'
    gnuplot>

Hi, gnuplot displays me Terminal type set to 'unknown'.
And if I enter the following command.

gnuplot> plot "./MergePlot.dat" with linespoint

Nothing happens.

Best Answer

Setting the correct terminal

The error you find means that gnuplot is not recognizing a valid terminal. You have to set a valid one. To know the list of the available ones you can ask from the command line of gnuplot

gnuplot> set terminal 

And it will answer with something like

Available terminal types:
       cairolatex  LaTeX picture environment using graphicx package 
                   and Cairo backend
           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

              ...  Many linees  ...

              gif  GIF images using libgd and TrueType fonts
             gpic  GPIC -- Produce graphs in groff using the 

              ...  Other linees  ...

For each of them you can ask to gnuplot itself for more information, for example with help terminal gif.

Then you can simply set the terminal, if you have try the dumb one it's lovely.

gnuplot> set terminal dumb
gnuplot> plot 0.5*sin(x/2)  lt 0, cos(x/2)



    1 ++---------------+---------------####---------------+---------------++
      +                +             ##  + ##          0.5*sin(x/2) +....+ +
  0.8 ++                            #        #             cos(x/2) ######++
      |                            #          #                            |
  0.6 ++                          #            #                          ++
      |++++++                    #              #+++++++                   |
  0.4 ++    +++                 #             ++ #     +++                ++
      #       +++               #           ++   #        ++               #
  0.2 +#        ++            ##          ++      ##        +             #+
    0 +#          ++          #          ++        #         ++           #+
      | #          ++        #         ++           #         ++         # |
 -0.2 ++ #           +      #         ++             #          ++      # ++
      |  ##           ++    #       ++               #           +++   ##  |
 -0.4 ++   #            +++#      ++                  #            +++#   ++
      |     #             #+++++++                     #             #+++++|
 -0.6 ++    #             #                            #             #    ++
      |      ##         ##                              ##         ##      |
 -0.8 ++      #        #                                  #        #      ++
      +        ##    ###                 +                ###    ##        +
   -1 ++---------#####-+-----------------+----------------+-#####---------++
     -10              -5                 0                5                10

If you have not the possibility to use a terminal from which "you can see" (wxt,qt,x11,aqua...), use a graphic format and save the output on an external file. In this way you will create a file in the directory from which you run gnuplot.

set terminal png enhanced truecolor    # ... whatever ...
  set output 'tempfile.png'            # you need to redirect to a file the output 
    plot 0.5*sin(x/2)  lt 0, cos(x/2)  # your plot commands     
    # replot # it should be cosy if you are not doing multiplot 
  set out                              # restore the output redirection
set terminal GNUTERM                   # restore the default terminal

Note:
You may need to install the different packages -qt,-nox,-x11 to have different features (the OP just did it) or to compile by yourself to add other ones.

Related Question