Search code examples
gnuplot

Extraneous arguments to set style line


I run the following script (only the main part of the script is shown)

# set-up
nutc = 1.0 # torque

# legend
set key top right

# 1st x axis
set xlabel 't in d^2/{/Symbol n}'
set format x "%.1f"
set xrange [0.0: 1.0]
set xtics   0.0, 0.5
set mxtics  2

# 1st y axis
set ylabel 'Nu_{/Symbol w}'
set format y "%.1f"
set yrange [-0.2:  3.0]
set ytics   -1.0,  1.0
set mytics   5

# grid lines
set nogrid

# line styles with colours appropriate for colour-blind
set style line 10 lc rgb '#000000' dt 2 lw 1.5 # black
set style line 11 lc rgb '#D55E00' dt 1 lw 1.5 # vermillon
set style line 12 lc rgb '#0072B2' dt 1 lw 1.5 # blue
set style line 13 lc rgb '#009E73' dt 1 lw 1.5 # bluish green
set style line 14 lc rgb '#E69F00' dt 1 lw 1.5 # orange
set style line 15 lc rgb '#56B4E9' dt 1 lw 1.5 # sky blue
set style line 16 lc rgb '#CC79A7' dt 1 lw 1.5 # reddish purple
set style line 17 lc rgb '#F0E442' dt 1 lw 1.5 # yellow 

# main plot
set style data lines
plot nutc t 'solution' ls 10,\
     'torque' u ($1):($2) t 'Inner' ls 11,\
     'torque' u ($1):($3) t 'Outer' ls 12

# convert to pdf (epstopdf comes with e.g. TeXlive)
system('epstopdf '.file)

Upon running it pops up the following error

enter image description here

What is the reason for the error and how to fix it? [I suppose the same issue exists for all the 8 lines in the line style setup section: lines 43-50]


Solution

  • According to the StackOverflow rules "no answers in the comments", let me summarize:

    You have a pretty old gnuplot version 4.6.2 (2013) which does not allow setting dashtype (dt) in the line style settings. Maybe there is a different approach or a workaround, but probably the easiest would be if you update to a newer version of gnuplot, see: https://sourceforge.net/projects/gnuplot/files/gnuplot/

    In the gnuplot console type set term and you will see the available terminals. That's what I get:

    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)
              domterm  DomTerm terminal emulator with embedded SVG
                 dumb  ascii art for anything that prints text
                  dxf  dxf-file for AutoCad (default size 120x80)
                  emf  Enhanced Metafile format
             epscairo  eps terminal based on cairo
             epslatex  LaTeX picture environment using graphicx package
                  fig  FIG graphics language V3.2 for XFIG graphics editor
                  gif  GIF images using libgd and TrueType fonts
                 hpgl  HP7475 and relatives [number of pens] [eject]
                 jpeg  JPEG images using libgd and TrueType fonts
                  lua  Lua generic terminal driver
                   mf  Metafont plotting standard
                   mp  MetaPost plotting standard
                 pcl5  PCL5e/PCL5c printers using HP-GL/2
             pdfcairo  pdf terminal based on cairo
               pict2e  LaTeX2e picture environment
                  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
                   qt  Qt cross-platform interactive terminal
              sixelgd  sixel using libgd and TrueType fonts
                  svg  W3C Scalable Vector Graphics
              texdraw  LaTeX texdraw environment
                 tikz  TeX TikZ graphics macros via the lua script driver
             tkcanvas  Tk canvas widget
              unknown  Unknown terminal type - not a plotting device
              windows  Microsoft Windows
                  wxt  wxWidgets cross-platform interactive terminal
    

    For your purpose, check help cairolatex, help epscairo, help epslatex and help pdfcairo.