5

I have a pretty complicated graph to plot from coordinates.A friend from here adviced me to use gnuplot and also helped me with the code which is the following...

\documentclass[border= 5mm]{standalone}
\usepackage{pgfplots, filecontents}
\pgfplotsset{colormap={bluered}{rgb255(0cm)=(0,0,180); rgb255(1cm)=(0,255,255);rgb255(2cm)=(100,255,0);rgb255(3cm)=(255,255,0); rgb255(4cm)=(255,0,0); rgb255(5cm)=(128,0,0)}} 
\begin{filecontents*}{data.txt}
1   1   70
2   1   48
3   1   41  
4   1   70
5  1   68
6   1   82
7   1   38
8   1   47
9   1   35
10  1   66
11  1   53
12  1   78
1   2   91
2   2   43
3   2   68
4   2   90
5  2   66
6   2   55
7   2   66
8   2   46
9   2   25
10  2   38
11  2   50
12  2   58
1   3   60
2   3   68
3   3   39
4   3   65
5  3   59
6   3   69
7   3   72
8   3   62
9   3   94
10  3   36
11  3   33
12  3   39
1   4   48
2   4   80
3   4   68
4   4   66
5  4   59
6   4   63
7   4   93
8   4   63
9   4   30
10  4   52
11  4   60
12  4   14
1  5  74
2  5  84
3  5  86
4  5  39
5  5  76
6  5  51
7  5  43
8  5  55
9  5  37
10  5  60
11  5  49
12  5  42
1  6  74
2  6  51
3  6  62
4  6  45
5  6  69
6  6  58
7  6  73
8  6  50
9  6  58
10  6  50
11  6  64
12  6  42
1  7  60
2  7  57
3  7  80
4  7  59
5  7  48
6  7  60
7  7  69
8  7  56
9  7  67
10  7  51
11  7  32
12  7  57
1  8  43
2  8  88
3  8  64
4  8  62
5  8  56
6  8  65
7  8  34
8  8  44
9  8  80
10  8  52
11  8  66
12  8  42
1  9  86
2  9  61
3  9  68
4  9  71
5  9  61
6  9  51
7  9  62
8  9  52
9  9  49
10  9  62
11  9  46
12  9  27
\end{filecontents*}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xtick={1,2,3,4,5,6,7,8,9,10,11,12},xticklabels={FRO,NOM,FER,EMM,COR,MOU,OZO,DRH,ELI,ANT,ARI,PAV},xmin=0,xmax=13,xlabel=Players,ylabel=Rounds,zlabel=Points Per Round,colormap/bluered,width=30cm,height=20cm,point meta min=30, point meta max=85]
 \addplot3 [surf] gnuplot [raw gnuplot] {
    set dgrid3d 52,52 spline;
    splot 'data.txt';       
};
\end{axis}
\end{tikzpicture}
\end{document}

This results to the following pic which is quite impressive BUT...

enter image description here

Ι wanted something more smooth...so I set dgrid3d 100,100 spline; This did not work because over 52 the tex capacity is exceeded... So by searching I found that lualatex does not have the same restrictions! So I tried the same code with lualatex...

But I got the next message:

enter image description here

So if anyone can help me use gnuplot with lualatex I would be grateful! Thanks in advance! A

  • Did you compile the file using lualatex --shell-escape <filename>, as suggested by the error message? – Aditya Nov 2 '13 at 20:47
  • Well, I had the shell-escape option when compiling with latex... I do not know how to use this option in lualatex. What should I do? – Ariscampis Nov 2 '13 at 21:07
  • 1
    It looks like you are using TeXShop. The standard LuaTeX engine does not enable the shell-escape option. I would recommend making a new engine with the option added. In ~/Library/TeXShop/Engines you'll find the LuaLaTeX.engine. Make a copy of it can call it LuaLaTeX-shell.engine. Edit this file and add the --shell-escape to the lualatex line in the Engine. Restart TeXShop and then the engine should appear in the pulldown menu. – Alan Munn Nov 3 '13 at 3:00
  • It appeared right in the pulldown menu... so I chose it to compile the code but I received again the same error message.In the engine I wrote this: #!/bin/tcsh set path= ($path /usr/texbin /usr/local/bin) lualatex --shell-escape-file-line-error -synctex=1 "$1" – Ariscampis Nov 3 '13 at 3:08
  • @Ariscampis Open the .engine file in TeXShop and make sure that the options are correctly introduced with --. When I opened the engine file by double clicking it, it opened in TextEdit and changed the -- to –. Your file compiles without error for me with the new values. Also, you need a space between each of the options. – Alan Munn Nov 3 '13 at 3:29
6

It looks like you are using TeXShop. The standard LuaTeX engine does not enable the shell-escape option. I would recommend making a new engine with the option added. In ~/Library/TeXShop/Engines you'll find the LuaLaTeX.engine. Make a copy of it can call it LuaLaTeX-shell.engine. Edit this file in TeXShop and add the --shell-escape to the lualatex line in the Engine.

The line should read:

lualatex --shell-escape --file-line-error --synctex=1 "$1"

Restart TeXShop and then the engine should appear in the pulldown menu. Use this engine to compile your LuaTeX+GNUplot files.

  • It worked perfectly!!! Thank you so much!!! Strangely I had to write: lualatex -shell-escape -file-line-error -synctex=1 "$1".Thanks again! – Ariscampis Nov 3 '13 at 3:52

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.