1

I'm trying to create a figure similar to figure 1 of this paper. I know how to make a cylinder with PGFPlots, but I'm new to 3D plots and I haven't mastered the art of colourmaps yet (and several Google searches yielded little of use and several things which seemed way too advanced for me). Basically, here's what I want to do:

  1. Define a function (e.g. e^(-x^2) or 1/(1+cosh(x)) or whatever) as an envelope
  2. Ask PGFPlots to generate random numbers between 0 and 1 with a distribution given by the envelope function defined previously
  3. Colour the cylinder using the collection of random numbers generated above: each random number could be the probability that one of the little rectangles defined by the cylinder's mesh is a certain colour (e.g. red) as opposed to another colour (e.g. green), so the density of red points is roughly equal to the envelope function

Edit: I made a picture of what I'm trying to achieve with steps 2 and 3. There are three cylinders. The top one shows the mesh; the cylinder is divided into little rectangles by this mesh. The centre and bottom cylinders have been coloured in such a way that the density of red squares is a function of the position along the cylinder (see the little hand-drawn graphs next to the cylinders): in the first case the density is linear, while in the second case the density is roughly a gaussian. Which individual rectangles are coloured red is random (I figure generating a random matrix of 0s and 1s should do the trick), but the density function (which is the function defined in step 1 above) determines how many rectangles are coloured red at each value of x,x being the position along the cylinder (or, in other words, how many 1s there are in each column of the random matrix as a function of the column's index). Hope that makes it clearer.

enter image description here

Here's my MWE (I'm using the hot2 colourmap, but obviously this would change):

\documentclass[11pt]{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathrsfs}
\usepackage{esvect}
\usepackage{latexsym}
\usepackage{mathtools}
\usepackage{graphics}
\usepackage{epstopdf}
\usepackage[pdftex]{graphicx}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `basename #1 .tif`.png}
\usepackage{float}
\usepackage{subfig}
\usepackage[utf8]{inputenc}

\newcommand{\figwidth}{0.85\linewidth}
\newcommand{\graphwidth}{1.2*\figwidth/sqrt(2)}

\usepackage{pgfplots}
\pgfplotsset{compat=1.9}

\begin{document}

\thispagestyle{empty}

\begin{figure}[b!]
\begin{center}
\scalebox{1}{\begin{tabular}{c}
\begin{tikzpicture}
\begin{axis}[width=\graphwidth,height=\graphwidth,xmin=-1.618,xmax=1.618,ymin=-4,ymax=4,zmin=-4,zmax=4,axis x line=none,axis y line=none,axis z line=none]
\addplot3[hide axis,surf,line join=round,domain=-1.618:1.618,domain y=0:360,samples=30,samples y=20,variable=\u,variable y=\v,point meta=u,axis lines=none,colormap/hot2]
({u},{sin(v)/2},{cos(v)/2});
\end{axis}
\end{tikzpicture}
\end{tabular}}
\end{center}
\end{figure}

\vfill

\end{document}

Thanks!

Rain
  • 194
  • I think your points 1 and 2 are clear, but I don't know (exactly) what you mean with point 3. Could you edit the question and be more specific. Maybe you could add a sketch of what you expect as result? – Stefan Pinnow Nov 26 '16 at 16:12
  • Ok, may I now ask how you have "created" the last two cylinders? I assume that you didn't do it with PGFPlots, right? – Stefan Pinnow Nov 26 '16 at 18:42
  • No, I did it by hand using a graphics app. link – Rain Nov 26 '16 at 19:16
  • (Also, if I'm using a range from 0 to 360 in the angle, why is the cylinder not closed?) – Rain Nov 26 '16 at 19:18

1 Answers1

5

Maybe there is a way to do this all in LaTeX/PGFPlots itself, but I think the best way is to calculate the needed values with an appropriate tool, export the data to a table and then use this table for the plot.

I have done all the calculations in Excel, but unfortunately listing the whole table isn't possible here, because of limited allowed characters per answer. This is, why the table is only listed truncated.

The idea of the calculation is to calculate "normalized" values of the function you want to use, where with "normalized" I mean, that the resulting values should range from 0 to 1. Then also create random numbers between 0 and 1 in each line. Last just compare the function value with the random value and return a 1 when the random number is smaller or equal the function value and 0 otherwise.

For more details about the PGFPlots stuff have a look at the comments in the code.

% used PGFPlots v1.14
% -------------------
% (truncated) calculated values in Excel
% (please note that Excel expects `SIN' and `COS' in radians, so the degree values have
%  to be multiplied by `PI()' and divided by `180')
\begin{filecontents}{Tube.txt}
%   samples 30  20      mean    0   =mean of max(x) and min(x)      
%   min -1.618  0       std_dev 0.75    adjusted manually       
%   max 1.618   360     max 0.531923041 ="gauss(mean)" using 'mean' and 'std_dev'       
%   Delta   3.236   360 =max-min                    
%                                   
%       =min + Delta/samples * i                            
%           =SIN(min + Delta/samples * j)/2                     
%               =COS(min + Delta/samples * j)/2                 
%                   =i/samples(x)               
%                       ="gauss(x)"/max using 'mean' and 'std_dev'          
%                           =random number between 0 and 1      
%                               =if (rnd <= line) then 1 else 0 
%                                   =if (rnd <= gauss) then 1 else 0
i   j   x   y   z   line    gauss   rnd line_prob   gauss_prob
0   0   -1.6180 0.0000  0.5000  0.0000  0.0976  0.6492  0   0
1   0   -1.5101 0.0000  0.5000  0.0333  0.1317  0.4835  0   0
2   0   -1.4023 0.0000  0.5000  0.0667  0.1741  0.0740  0   1
3   0   -1.2944 0.0000  0.5000  0.1000  0.2255  0.1161  0   1
4   0   -1.1865 0.0000  0.5000  0.1333  0.2861  0.6738  0   0
5   0   -1.0787 0.0000  0.5000  0.1667  0.3555  0.2065  0   1
6   0   -0.9708 0.0000  0.5000  0.2000  0.4327  0.9035  0   0
7   0   -0.8629 0.0000  0.5000  0.2333  0.5159  0.8246  0   0
8   0   -0.7551 0.0000  0.5000  0.2667  0.6024  0.7371  0   0
9   0   -0.6472 0.0000  0.5000  0.3000  0.6891  0.4873  0   1
10  0   -0.5393 0.0000  0.5000  0.3333  0.7722  0.1399  1   1
11  0   -0.4315 0.0000  0.5000  0.3667  0.8475  0.4504  0   1
12  0   -0.3236 0.0000  0.5000  0.4000  0.9111  0.5110  0   1
13  0   -0.2157 0.0000  0.5000  0.4333  0.9595  0.5916  0   1
14  0   -0.1079 0.0000  0.5000  0.4667  0.9897  0.3485  1   1
15  0   0.0000  0.0000  0.5000  0.5000  1.0000  0.7374  0   1
16  0   0.1079  0.0000  0.5000  0.5333  0.9897  0.4171  1   1
17  0   0.2157  0.0000  0.5000  0.5667  0.9595  0.4803  1   1
18  0   0.3236  0.0000  0.5000  0.6000  0.9111  0.0555  1   1
19  0   0.4315  0.0000  0.5000  0.6333  0.8475  0.5020  1   1
20  0   0.5393  0.0000  0.5000  0.6667  0.7722  0.7817  0   0
21  0   0.6472  0.0000  0.5000  0.7000  0.6891  0.5289  1   1
22  0   0.7551  0.0000  0.5000  0.7333  0.6024  0.6084  1   0
23  0   0.8629  0.0000  0.5000  0.7667  0.5159  0.2050  1   1
24  0   0.9708  0.0000  0.5000  0.8000  0.4327  0.5781  1   0
25  0   1.0787  0.0000  0.5000  0.8333  0.3555  0.4007  1   0
26  0   1.1865  0.0000  0.5000  0.8667  0.2861  0.9156  0   0
27  0   1.2944  0.0000  0.5000  0.9000  0.2255  0.1898  1   1
28  0   1.4023  0.0000  0.5000  0.9333  0.1741  0.6602  1   0
29  0   1.5101  0.0000  0.5000  0.9667  0.1317  0.0466  1   1
30  0   1.6180  0.0000  0.5000  1.0000  0.0976  0.6481  1   0

0   1   -1.6180 0.1545  0.4755  0.0000  0.0976  0.2572  0   0
1   1   -1.5101 0.1545  0.4755  0.0333  0.1317  0.3264  0   0
2   1   -1.4023 0.1545  0.4755  0.0667  0.1741  0.0959  0   1
3   1   -1.2944 0.1545  0.4755  0.1000  0.2255  0.2411  0   0
4   1   -1.1865 0.1545  0.4755  0.1333  0.2861  0.9879  0   0
5   1   -1.0787 0.1545  0.4755  0.1667  0.3555  0.3327  0   1
6   1   -0.9708 0.1545  0.4755  0.2000  0.4327  0.8484  0   0
7   1   -0.8629 0.1545  0.4755  0.2333  0.5159  0.9666  0   0
8   1   -0.7551 0.1545  0.4755  0.2667  0.6024  0.5282  0   1
9   1   -0.6472 0.1545  0.4755  0.3000  0.6891  0.1280  1   1
10  1   -0.5393 0.1545  0.4755  0.3333  0.7722  0.9072  0   0
11  1   -0.4315 0.1545  0.4755  0.3667  0.8475  0.6125  0   1
12  1   -0.3236 0.1545  0.4755  0.4000  0.9111  0.0583  1   1
13  1   -0.2157 0.1545  0.4755  0.4333  0.9595  0.9994  0   0
14  1   -0.1079 0.1545  0.4755  0.4667  0.9897  0.1308  1   1
15  1   0.0000  0.1545  0.4755  0.5000  1.0000  0.3638  1   1
16  1   0.1079  0.1545  0.4755  0.5333  0.9897  0.3305  1   1
17  1   0.2157  0.1545  0.4755  0.5667  0.9595  0.4646  1   1
18  1   0.3236  0.1545  0.4755  0.6000  0.9111  0.0560  1   1
19  1   0.4315  0.1545  0.4755  0.6333  0.8475  0.4014  1   1
20  1   0.5393  0.1545  0.4755  0.6667  0.7722  0.9265  0   0
21  1   0.6472  0.1545  0.4755  0.7000  0.6891  0.1999  1   1
22  1   0.7551  0.1545  0.4755  0.7333  0.6024  0.1131  1   1
23  1   0.8629  0.1545  0.4755  0.7667  0.5159  0.2446  1   1
24  1   0.9708  0.1545  0.4755  0.8000  0.4327  0.0015  1   1
25  1   1.0787  0.1545  0.4755  0.8333  0.3555  0.8032  1   0
26  1   1.1865  0.1545  0.4755  0.8667  0.2861  0.6315  1   0
27  1   1.2944  0.1545  0.4755  0.9000  0.2255  0.4118  1   0
28  1   1.4023  0.1545  0.4755  0.9333  0.1741  0.5684  1   0
29  1   1.5101  0.1545  0.4755  0.9667  0.1317  0.8531  1   0
30  1   1.6180  0.1545  0.4755  1.0000  0.0976  0.5455  1   0

0   2   -1.6180 0.2939  0.4045  0.0000  0.0976  0.4158  0   0
1   2   -1.5101 0.2939  0.4045  0.0333  0.1317  0.3258  0   0
2   2   -1.4023 0.2939  0.4045  0.0667  0.1741  0.5895  0   0
3   2   -1.2944 0.2939  0.4045  0.1000  0.2255  0.3345  0   0
4   2   -1.1865 0.2939  0.4045  0.1333  0.2861  0.5082  0   0
5   2   -1.0787 0.2939  0.4045  0.1667  0.3555  0.3005  0   1
6   2   -0.9708 0.2939  0.4045  0.2000  0.4327  0.5249  0   0
7   2   -0.8629 0.2939  0.4045  0.2333  0.5159  0.4941  0   1
8   2   -0.7551 0.2939  0.4045  0.2667  0.6024  0.8054  0   0
9   2   -0.6472 0.2939  0.4045  0.3000  0.6891  0.5808  0   1
10  2   -0.5393 0.2939  0.4045  0.3333  0.7722  0.1408  1   1
11  2   -0.4315 0.2939  0.4045  0.3667  0.8475  0.0638  1   1
12  2   -0.3236 0.2939  0.4045  0.4000  0.9111  0.3708  1   1
13  2   -0.2157 0.2939  0.4045  0.4333  0.9595  0.0598  1   1
14  2   -0.1079 0.2939  0.4045  0.4667  0.9897  0.8103  0   1
15  2   0.0000  0.2939  0.4045  0.5000  1.0000  0.2983  1   1
16  2   0.1079  0.2939  0.4045  0.5333  0.9897  0.6877  0   1
17  2   0.2157  0.2939  0.4045  0.5667  0.9595  0.0418  1   1
18  2   0.3236  0.2939  0.4045  0.6000  0.9111  0.7973  0   1
19  2   0.4315  0.2939  0.4045  0.6333  0.8475  0.0788  1   1
20  2   0.5393  0.2939  0.4045  0.6667  0.7722  0.3082  1   1
21  2   0.6472  0.2939  0.4045  0.7000  0.6891  0.4959  1   1
22  2   0.7551  0.2939  0.4045  0.7333  0.6024  0.4133  1   1
23  2   0.8629  0.2939  0.4045  0.7667  0.5159  0.3124  1   1
24  2   0.9708  0.2939  0.4045  0.8000  0.4327  0.7795  1   0
25  2   1.0787  0.2939  0.4045  0.8333  0.3555  0.4642  1   0
26  2   1.1865  0.2939  0.4045  0.8667  0.2861  0.4465  1   0
27  2   1.2944  0.2939  0.4045  0.9000  0.2255  0.1810  1   1
28  2   1.4023  0.2939  0.4045  0.9333  0.1741  0.2617  1   0
29  2   1.5101  0.2939  0.4045  0.9667  0.1317  0.2650  1   0
30  2   1.6180  0.2939  0.4045  1.0000  0.0976  0.6748  1   0

0   3   -1.6180 0.4045  0.2939  0.0000  0.0976  0.8537  0   0
1   3   -1.5101 0.4045  0.2939  0.0333  0.1317  0.8746  0   0
2   3   -1.4023 0.4045  0.2939  0.0667  0.1741  0.0061  1   1
3   3   -1.2944 0.4045  0.2939  0.1000  0.2255  0.0966  1   1
4   3   -1.1865 0.4045  0.2939  0.1333  0.2861  0.1959  0   1
5   3   -1.0787 0.4045  0.2939  0.1667  0.3555  0.9817  0   0
6   3   -0.9708 0.4045  0.2939  0.2000  0.4327  0.3579  0   1
7   3   -0.8629 0.4045  0.2939  0.2333  0.5159  0.9460  0   0
8   3   -0.7551 0.4045  0.2939  0.2667  0.6024  0.2798  0   1
9   3   -0.6472 0.4045  0.2939  0.3000  0.6891  0.0691  1   1
10  3   -0.5393 0.4045  0.2939  0.3333  0.7722  0.3850  0   1
11  3   -0.4315 0.4045  0.2939  0.3667  0.8475  0.8794  0   0
12  3   -0.3236 0.4045  0.2939  0.4000  0.9111  0.6184  0   1
13  3   -0.2157 0.4045  0.2939  0.4333  0.9595  0.1340  1   1
14  3   -0.1079 0.4045  0.2939  0.4667  0.9897  0.3048  1   1
15  3   0.0000  0.4045  0.2939  0.5000  1.0000  0.1001  1   1
16  3   0.1079  0.4045  0.2939  0.5333  0.9897  0.8135  0   1
17  3   0.2157  0.4045  0.2939  0.5667  0.9595  0.2595  1   1
18  3   0.3236  0.4045  0.2939  0.6000  0.9111  0.6395  0   1
19  3   0.4315  0.4045  0.2939  0.6333  0.8475  0.2270  1   1
20  3   0.5393  0.4045  0.2939  0.6667  0.7722  0.1332  1   1
21  3   0.6472  0.4045  0.2939  0.7000  0.6891  0.7902  0   0
22  3   0.7551  0.4045  0.2939  0.7333  0.6024  0.7623  0   0
23  3   0.8629  0.4045  0.2939  0.7667  0.5159  0.6940  1   0
24  3   0.9708  0.4045  0.2939  0.8000  0.4327  0.1243  1   1
25  3   1.0787  0.4045  0.2939  0.8333  0.3555  0.9561  0   0
26  3   1.1865  0.4045  0.2939  0.8667  0.2861  0.5584  1   0
27  3   1.2944  0.4045  0.2939  0.9000  0.2255  0.2714  1   0
28  3   1.4023  0.4045  0.2939  0.9333  0.1741  0.9831  0   0
29  3   1.5101  0.4045  0.2939  0.9667  0.1317  0.7792  1   0
30  3   1.6180  0.4045  0.2939  1.0000  0.0976  0.2699  1   0

0   4   -1.6180 0.4755  0.1545  0.0000  0.0976  0.5187  0   0
1   4   -1.5101 0.4755  0.1545  0.0333  0.1317  0.3087  0   0
2   4   -1.4023 0.4755  0.1545  0.0667  0.1741  0.3495  0   0
3   4   -1.2944 0.4755  0.1545  0.1000  0.2255  0.1869  0   1
4   4   -1.1865 0.4755  0.1545  0.1333  0.2861  0.0646  1   1
5   4   -1.0787 0.4755  0.1545  0.1667  0.3555  0.4959  0   0
6   4   -0.9708 0.4755  0.1545  0.2000  0.4327  0.3920  0   1
7   4   -0.8629 0.4755  0.1545  0.2333  0.5159  0.9231  0   0
8   4   -0.7551 0.4755  0.1545  0.2667  0.6024  0.5030  0   1
9   4   -0.6472 0.4755  0.1545  0.3000  0.6891  0.8132  0   0
10  4   -0.5393 0.4755  0.1545  0.3333  0.7722  0.8689  0   0
11  4   -0.4315 0.4755  0.1545  0.3667  0.8475  0.8939  0   0
12  4   -0.3236 0.4755  0.1545  0.4000  0.9111  0.6802  0   1
13  4   -0.2157 0.4755  0.1545  0.4333  0.9595  0.7853  0   1
14  4   -0.1079 0.4755  0.1545  0.4667  0.9897  0.2149  1   1
15  4   0.0000  0.4755  0.1545  0.5000  1.0000  0.9261  0   1
16  4   0.1079  0.4755  0.1545  0.5333  0.9897  0.7757  0   1
17  4   0.2157  0.4755  0.1545  0.5667  0.9595  0.5704  0   1
18  4   0.3236  0.4755  0.1545  0.6000  0.9111  0.0133  1   1
19  4   0.4315  0.4755  0.1545  0.6333  0.8475  0.7098  0   1
20  4   0.5393  0.4755  0.1545  0.6667  0.7722  0.6190  1   1
21  4   0.6472  0.4755  0.1545  0.7000  0.6891  0.7910  0   0
22  4   0.7551  0.4755  0.1545  0.7333  0.6024  0.7627  0   0
23  4   0.8629  0.4755  0.1545  0.7667  0.5159  0.4855  1   1
24  4   0.9708  0.4755  0.1545  0.8000  0.4327  0.6283  1   0
25  4   1.0787  0.4755  0.1545  0.8333  0.3555  0.7454  1   0
26  4   1.1865  0.4755  0.1545  0.8667  0.2861  0.7729  1   0
27  4   1.2944  0.4755  0.1545  0.9000  0.2255  0.8944  1   0
28  4   1.4023  0.4755  0.1545  0.9333  0.1741  0.8292  1   0
29  4   1.5101  0.4755  0.1545  0.9667  0.1317  0.2504  1   0
30  4   1.6180  0.4755  0.1545  1.0000  0.0976  0.0299  1   1

0   5   -1.6180 0.5000  0.0000  0.0000  0.0976  0.7368  0   0
1   5   -1.5101 0.5000  0.0000  0.0333  0.1317  0.5822  0   0
2   5   -1.4023 0.5000  0.0000  0.0667  0.1741  0.1081  0   1
3   5   -1.2944 0.5000  0.0000  0.1000  0.2255  0.6272  0   0
4   5   -1.1865 0.5000  0.0000  0.1333  0.2861  0.2319  0   1
5   5   -1.0787 0.5000  0.0000  0.1667  0.3555  0.1011  1   1
6   5   -0.9708 0.5000  0.0000  0.2000  0.4327  0.9278  0   0
7   5   -0.8629 0.5000  0.0000  0.2333  0.5159  0.3546  0   1
8   5   -0.7551 0.5000  0.0000  0.2667  0.6024  0.4562  0   1
9   5   -0.6472 0.5000  0.0000  0.3000  0.6891  0.6514  0   1
10  5   -0.5393 0.5000  0.0000  0.3333  0.7722  0.2120  1   1
11  5   -0.4315 0.5000  0.0000  0.3667  0.8475  0.8445  0   1
12  5   -0.3236 0.5000  0.0000  0.4000  0.9111  0.3426  1   1
13  5   -0.2157 0.5000  0.0000  0.4333  0.9595  0.2548  1   1
14  5   -0.1079 0.5000  0.0000  0.4667  0.9897  0.9409  0   1
15  5   0.0000  0.5000  0.0000  0.5000  1.0000  0.1256  1   1
16  5   0.1079  0.5000  0.0000  0.5333  0.9897  0.5366  0   1
17  5   0.2157  0.5000  0.0000  0.5667  0.9595  0.0420  1   1
18  5   0.3236  0.5000  0.0000  0.6000  0.9111  0.2165  1   1
19  5   0.4315  0.5000  0.0000  0.6333  0.8475  0.1289  1   1
20  5   0.5393  0.5000  0.0000  0.6667  0.7722  0.6235  1   1
21  5   0.6472  0.5000  0.0000  0.7000  0.6891  0.2551  1   1
22  5   0.7551  0.5000  0.0000  0.7333  0.6024  0.8945  0   0
23  5   0.8629  0.5000  0.0000  0.7667  0.5159  0.4717  1   1
24  5   0.9708  0.5000  0.0000  0.8000  0.4327  0.9358  0   0
25  5   1.0787  0.5000  0.0000  0.8333  0.3555  0.0820  1   1
26  5   1.1865  0.5000  0.0000  0.8667  0.2861  0.0604  1   1
27  5   1.2944  0.5000  0.0000  0.9000  0.2255  0.1954  1   1
28  5   1.4023  0.5000  0.0000  0.9333  0.1741  0.2084  1   0
29  5   1.5101  0.5000  0.0000  0.9667  0.1317  0.7770  1   0
30  5   1.6180  0.5000  0.0000  1.0000  0.0976  0.4143  1   0

0   6   -1.6180 0.4755  -0.1545 0.0000  0.0976  0.3738  0   0
1   6   -1.5101 0.4755  -0.1545 0.0333  0.1317  0.6845  0   0
2   6   -1.4023 0.4755  -0.1545 0.0667  0.1741  0.6568  0   0
3   6   -1.2944 0.4755  -0.1545 0.1000  0.2255  0.5355  0   0
4   6   -1.1865 0.4755  -0.1545 0.1333  0.2861  0.9864  0   0
5   6   -1.0787 0.4755  -0.1545 0.1667  0.3555  0.0064  1   1
6   6   -0.9708 0.4755  -0.1545 0.2000  0.4327  0.5717  0   0
7   6   -0.8629 0.4755  -0.1545 0.2333  0.5159  0.1004  1   1
8   6   -0.7551 0.4755  -0.1545 0.2667  0.6024  0.1916  1   1
9   6   -0.6472 0.4755  -0.1545 0.3000  0.6891  0.0313  1   1
10  6   -0.5393 0.4755  -0.1545 0.3333  0.7722  0.1225  1   1
11  6   -0.4315 0.4755  -0.1545 0.3667  0.8475  0.7645  0   1
12  6   -0.3236 0.4755  -0.1545 0.4000  0.9111  0.4462  0   1
13  6   -0.2157 0.4755  -0.1545 0.4333  0.9595  0.4357  0   1
14  6   -0.1079 0.4755  -0.1545 0.4667  0.9897  0.2171  1   1
15  6   0.0000  0.4755  -0.1545 0.5000  1.0000  0.9748  0   1
16  6   0.1079  0.4755  -0.1545 0.5333  0.9897  0.1093  1   1
17  6   0.2157  0.4755  -0.1545 0.5667  0.9595  0.8422  0   1
18  6   0.3236  0.4755  -0.1545 0.6000  0.9111  0.9601  0   0
19  6   0.4315  0.4755  -0.1545 0.6333  0.8475  0.6425  0   1
20  6   0.5393  0.4755  -0.1545 0.6667  0.7722  0.2703  1   1
21  6   0.6472  0.4755  -0.1545 0.7000  0.6891  0.7888  0   0
22  6   0.7551  0.4755  -0.1545 0.7333  0.6024  0.8058  0   0
23  6   0.8629  0.4755  -0.1545 0.7667  0.5159  0.9447  0   0
24  6   0.9708  0.4755  -0.1545 0.8000  0.4327  0.2103  1   1
25  6   1.0787  0.4755  -0.1545 0.8333  0.3555  0.9621  0   0
26  6   1.1865  0.4755  -0.1545 0.8667  0.2861  0.9938  0   0
27  6   1.2944  0.4755  -0.1545 0.9000  0.2255  0.8342  1   0
28  6   1.4023  0.4755  -0.1545 0.9333  0.1741  0.1231  1   1
29  6   1.5101  0.4755  -0.1545 0.9667  0.1317  0.4672  1   0
30  6   1.6180  0.4755  -0.1545 1.0000  0.0976  0.4592  1   0

0   7   -1.6180 0.4045  -0.2939 0.0000  0.0976  0.5182  0   0
1   7   -1.5101 0.4045  -0.2939 0.0333  0.1317  0.0015  1   1
2   7   -1.4023 0.4045  -0.2939 0.0667  0.1741  0.1600  0   1
3   7   -1.2944 0.4045  -0.2939 0.1000  0.2255  0.7924  0   0
4   7   -1.1865 0.4045  -0.2939 0.1333  0.2861  0.5220  0   0
5   7   -1.0787 0.4045  -0.2939 0.1667  0.3555  0.1471  1   1
6   7   -0.9708 0.4045  -0.2939 0.2000  0.4327  0.6365  0   0
7   7   -0.8629 0.4045  -0.2939 0.2333  0.5159  0.0619  1   1
8   7   -0.7551 0.4045  -0.2939 0.2667  0.6024  0.1535  1   1
9   7   -0.6472 0.4045  -0.2939 0.3000  0.6891  0.5096  0   1
10  7   -0.5393 0.4045  -0.2939 0.3333  0.7722  0.2211  1   1
11  7   -0.4315 0.4045  -0.2939 0.3667  0.8475  0.5148  0   1
12  7   -0.3236 0.4045  -0.2939 0.4000  0.9111  0.2902  1   1
13  7   -0.2157 0.4045  -0.2939 0.4333  0.9595  0.5552  0   1
14  7   -0.1079 0.4045  -0.2939 0.4667  0.9897  0.4117  1   1
15  7   0.0000  0.4045  -0.2939 0.5000  1.0000  0.7931  0   1
16  7   0.1079  0.4045  -0.2939 0.5333  0.9897  0.1665  1   1
17  7   0.2157  0.4045  -0.2939 0.5667  0.9595  0.8477  0   1
18  7   0.3236  0.4045  -0.2939 0.6000  0.9111  0.7467  0   1
19  7   0.4315  0.4045  -0.2939 0.6333  0.8475  0.3096  1   1
20  7   0.5393  0.4045  -0.2939 0.6667  0.7722  0.1961  1   1
21  7   0.6472  0.4045  -0.2939 0.7000  0.6891  0.5500  1   1
22  7   0.7551  0.4045  -0.2939 0.7333  0.6024  0.1558  1   1
23  7   0.8629  0.4045  -0.2939 0.7667  0.5159  0.3210  1   1
24  7   0.9708  0.4045  -0.2939 0.8000  0.4327  0.2309  1   1
25  7   1.0787  0.4045  -0.2939 0.8333  0.3555  0.1315  1   1
26  7   1.1865  0.4045  -0.2939 0.8667  0.2861  0.1296  1   1
27  7   1.2944  0.4045  -0.2939 0.9000  0.2255  0.5655  1   0
28  7   1.4023  0.4045  -0.2939 0.9333  0.1741  0.3790  1   0
29  7   1.5101  0.4045  -0.2939 0.9667  0.1317  0.5505  1   0
30  7   1.6180  0.4045  -0.2939 1.0000  0.0976  0.7044  1   0

0   8   -1.6180 0.2939  -0.4045 0.0000  0.0976  0.9304  0   0
1   8   -1.5101 0.2939  -0.4045 0.0333  0.1317  0.4888  0   0
2   8   -1.4023 0.2939  -0.4045 0.0667  0.1741  0.2589  0   0
3   8   -1.2944 0.2939  -0.4045 0.1000  0.2255  0.7642  0   0
4   8   -1.1865 0.2939  -0.4045 0.1333  0.2861  0.9318  0   0
5   8   -1.0787 0.2939  -0.4045 0.1667  0.3555  0.8123  0   0
6   8   -0.9708 0.2939  -0.4045 0.2000  0.4327  0.2629  0   1
7   8   -0.8629 0.2939  -0.4045 0.2333  0.5159  0.2556  0   1
8   8   -0.7551 0.2939  -0.4045 0.2667  0.6024  0.2752  0   1
9   8   -0.6472 0.2939  -0.4045 0.3000  0.6891  0.7589  0   0
10  8   -0.5393 0.2939  -0.4045 0.3333  0.7722  0.5316  0   1
11  8   -0.4315 0.2939  -0.4045 0.3667  0.8475  0.3329  1   1
12  8   -0.3236 0.2939  -0.4045 0.4000  0.9111  0.9994  0   0
13  8   -0.2157 0.2939  -0.4045 0.4333  0.9595  0.3179  1   1
14  8   -0.1079 0.2939  -0.4045 0.4667  0.9897  0.9643  0   1
15  8   0.0000  0.2939  -0.4045 0.5000  1.0000  0.1634  1   1
16  8   0.1079  0.2939  -0.4045 0.5333  0.9897  0.8424  0   1
17  8   0.2157  0.2939  -0.4045 0.5667  0.9595  0.8916  0   1
18  8   0.3236  0.2939  -0.4045 0.6000  0.9111  0.0334  1   1
19  8   0.4315  0.2939  -0.4045 0.6333  0.8475  0.2965  1   1
20  8   0.5393  0.2939  -0.4045 0.6667  0.7722  0.0651  1   1
21  8   0.6472  0.2939  -0.4045 0.7000  0.6891  0.6940  1   0
22  8   0.7551  0.2939  -0.4045 0.7333  0.6024  0.9465  0   0
23  8   0.8629  0.2939  -0.4045 0.7667  0.5159  0.3530  1   1
24  8   0.9708  0.2939  -0.4045 0.8000  0.4327  0.2961  1   1
25  8   1.0787  0.2939  -0.4045 0.8333  0.3555  0.5616  1   0
26  8   1.1865  0.2939  -0.4045 0.8667  0.2861  0.9891  0   0
27  8   1.2944  0.2939  -0.4045 0.9000  0.2255  0.7516  1   0
28  8   1.4023  0.2939  -0.4045 0.9333  0.1741  0.8895  1   0
29  8   1.5101  0.2939  -0.4045 0.9667  0.1317  0.6663  1   0
30  8   1.6180  0.2939  -0.4045 1.0000  0.0976  0.5823  1   0

0   9   -1.6180 0.1545  -0.4755 0.0000  0.0976  0.5990  0   0
1   9   -1.5101 0.1545  -0.4755 0.0333  0.1317  0.4553  0   0
2   9   -1.4023 0.1545  -0.4755 0.0667  0.1741  0.5058  0   0
3   9   -1.2944 0.1545  -0.4755 0.1000  0.2255  0.1938  0   1
4   9   -1.1865 0.1545  -0.4755 0.1333  0.2861  0.0665  1   1
5   9   -1.0787 0.1545  -0.4755 0.1667  0.3555  0.5587  0   0
6   9   -0.9708 0.1545  -0.4755 0.2000  0.4327  0.4255  0   1
7   9   -0.8629 0.1545  -0.4755 0.2333  0.5159  0.9089  0   0
8   9   -0.7551 0.1545  -0.4755 0.2667  0.6024  0.8872  0   0
9   9   -0.6472 0.1545  -0.4755 0.3000  0.6891  0.0293  1   1
10  9   -0.5393 0.1545  -0.4755 0.3333  0.7722  0.4810  0   1
11  9   -0.4315 0.1545  -0.4755 0.3667  0.8475  0.1498  1   1
12  9   -0.3236 0.1545  -0.4755 0.4000  0.9111  0.7943  0   1
13  9   -0.2157 0.1545  -0.4755 0.4333  0.9595  0.5909  0   1
14  9   -0.1079 0.1545  -0.4755 0.4667  0.9897  0.1659  1   1
15  9   0.0000  0.1545  -0.4755 0.5000  1.0000  0.3384  1   1
16  9   0.1079  0.1545  -0.4755 0.5333  0.9897  0.5837  0   1
17  9   0.2157  0.1545  -0.4755 0.5667  0.9595  0.2849  1   1
18  9   0.3236  0.1545  -0.4755 0.6000  0.9111  0.2183  1   1
19  9   0.4315  0.1545  -0.4755 0.6333  0.8475  0.8260  0   1
20  9   0.5393  0.1545  -0.4755 0.6667  0.7722  0.7043  0   1
21  9   0.6472  0.1545  -0.4755 0.7000  0.6891  0.3959  1   1
22  9   0.7551  0.1545  -0.4755 0.7333  0.6024  0.8614  0   0
23  9   0.8629  0.1545  -0.4755 0.7667  0.5159  0.5600  1   0
24  9   0.9708  0.1545  -0.4755 0.8000  0.4327  0.3591  1   1
25  9   1.0787  0.1545  -0.4755 0.8333  0.3555  0.6904  1   0
26  9   1.1865  0.1545  -0.4755 0.8667  0.2861  0.1063  1   1
27  9   1.2944  0.1545  -0.4755 0.9000  0.2255  0.0090  1   1
28  9   1.4023  0.1545  -0.4755 0.9333  0.1741  0.1299  1   1
29  9   1.5101  0.1545  -0.4755 0.9667  0.1317  0.7372  1   0
30  9   1.6180  0.1545  -0.4755 1.0000  0.0976  0.2211  1   0

0   10  -1.6180 0.0000  -0.5000 0.0000  0.0976  0.7323  0   0
1   10  -1.5101 0.0000  -0.5000 0.0333  0.1317  0.8101  0   0
2   10  -1.4023 0.0000  -0.5000 0.0667  0.1741  0.0112  1   1
3   10  -1.2944 0.0000  -0.5000 0.1000  0.2255  0.0332  1   1
4   10  -1.1865 0.0000  -0.5000 0.1333  0.2861  0.2969  0   0
5   10  -1.0787 0.0000  -0.5000 0.1667  0.3555  0.8125  0   0
6   10  -0.9708 0.0000  -0.5000 0.2000  0.4327  0.9808  0   0
7   10  -0.8629 0.0000  -0.5000 0.2333  0.5159  0.4134  0   1
8   10  -0.7551 0.0000  -0.5000 0.2667  0.6024  0.7641  0   0
9   10  -0.6472 0.0000  -0.5000 0.3000  0.6891  0.4022  0   1
10  10  -0.5393 0.0000  -0.5000 0.3333  0.7722  0.6320  0   1
11  10  -0.4315 0.0000  -0.5000 0.3667  0.8475  0.8502  0   0
12  10  -0.3236 0.0000  -0.5000 0.4000  0.9111  0.1490  1   1
13  10  -0.2157 0.0000  -0.5000 0.4333  0.9595  0.4731  0   1
14  10  -0.1079 0.0000  -0.5000 0.4667  0.9897  0.4293  1   1
15  10  0.0000  0.0000  -0.5000 0.5000  1.0000  0.2566  1   1
16  10  0.1079  0.0000  -0.5000 0.5333  0.9897  0.4522  1   1
17  10  0.2157  0.0000  -0.5000 0.5667  0.9595  0.7684  0   1
18  10  0.3236  0.0000  -0.5000 0.6000  0.9111  0.4532  1   1
19  10  0.4315  0.0000  -0.5000 0.6333  0.8475  0.2543  1   1
20  10  0.5393  0.0000  -0.5000 0.6667  0.7722  0.1706  1   1
21  10  0.6472  0.0000  -0.5000 0.7000  0.6891  0.4425  1   1
22  10  0.7551  0.0000  -0.5000 0.7333  0.6024  0.6825  1   0
23  10  0.8629  0.0000  -0.5000 0.7667  0.5159  0.2464  1   1
24  10  0.9708  0.0000  -0.5000 0.8000  0.4327  0.1324  1   1
25  10  1.0787  0.0000  -0.5000 0.8333  0.3555  0.9081  0   0
26  10  1.1865  0.0000  -0.5000 0.8667  0.2861  0.4219  1   0
27  10  1.2944  0.0000  -0.5000 0.9000  0.2255  0.6048  1   0
28  10  1.4023  0.0000  -0.5000 0.9333  0.1741  0.7224  1   0
29  10  1.5101  0.0000  -0.5000 0.9667  0.1317  0.9392  1   0
30  10  1.6180  0.0000  -0.5000 1.0000  0.0976  0.7372  1   0

0   11  -1.6180 -0.1545 -0.4755 0.0000  0.0976  0.3551  0   0
1   11  -1.5101 -0.1545 -0.4755 0.0333  0.1317  0.3294  0   0
2   11  -1.4023 -0.1545 -0.4755 0.0667  0.1741  0.5342  0   0
3   11  -1.2944 -0.1545 -0.4755 0.1000  0.2255  0.9791  0   0
4   11  -1.1865 -0.1545 -0.4755 0.1333  0.2861  0.3603  0   0
5   11  -1.0787 -0.1545 -0.4755 0.1667  0.3555  0.6096  0   0
6   11  -0.9708 -0.1545 -0.4755 0.2000  0.4327  0.4828  0   0
7   11  -0.8629 -0.1545 -0.4755 0.2333  0.5159  0.3182  0   1
8   11  -0.7551 -0.1545 -0.4755 0.2667  0.6024  0.2447  1   1
9   11  -0.6472 -0.1545 -0.4755 0.3000  0.6891  0.2751  1   1
10  11  -0.5393 -0.1545 -0.4755 0.3333  0.7722  0.8134  0   0
11  11  -0.4315 -0.1545 -0.4755 0.3667  0.8475  0.6176  0   1
12  11  -0.3236 -0.1545 -0.4755 0.4000  0.9111  0.2344  1   1
13  11  -0.2157 -0.1545 -0.4755 0.4333  0.9595  0.0245  1   1
14  11  -0.1079 -0.1545 -0.4755 0.4667  0.9897  0.8187  0   1
15  11  0.0000  -0.1545 -0.4755 0.5000  1.0000  0.9989  0   1
16  11  0.1079  -0.1545 -0.4755 0.5333  0.9897  0.0971  1   1
17  11  0.2157  -0.1545 -0.4755 0.5667  0.9595  0.1361  1   1
18  11  0.3236  -0.1545 -0.4755 0.6000  0.9111  0.0748  1   1
19  11  0.4315  -0.1545 -0.4755 0.6333  0.8475  0.3664  1   1
20  11  0.5393  -0.1545 -0.4755 0.6667  0.7722  0.3334  1   1
21  11  0.6472  -0.1545 -0.4755 0.7000  0.6891  0.8233  0   0
22  11  0.7551  -0.1545 -0.4755 0.7333  0.6024  0.0426  1   1
23  11  0.8629  -0.1545 -0.4755 0.7667  0.5159  0.6530  1   0
24  11  0.9708  -0.1545 -0.4755 0.8000  0.4327  0.6933  1   0
25  11  1.0787  -0.1545 -0.4755 0.8333  0.3555  0.9115  0   0
26  11  1.1865  -0.1545 -0.4755 0.8667  0.2861  0.4942  1   0
27  11  1.2944  -0.1545 -0.4755 0.9000  0.2255  0.4037  1   0
28  11  1.4023  -0.1545 -0.4755 0.9333  0.1741  0.4264  1   0
29  11  1.5101  -0.1545 -0.4755 0.9667  0.1317  0.8665  1   0
30  11  1.6180  -0.1545 -0.4755 1.0000  0.0976  0.4228  1   0

0   12  -1.6180 -0.2939 -0.4045 0.0000  0.0976  0.1508  0   0
1   12  -1.5101 -0.2939 -0.4045 0.0333  0.1317  0.6083  0   0
2   12  -1.4023 -0.2939 -0.4045 0.0667  0.1741  0.1707  0   1
3   12  -1.2944 -0.2939 -0.4045 0.1000  0.2255  0.6290  0   0
4   12  -1.1865 -0.2939 -0.4045 0.1333  0.2861  0.7307  0   0
5   12  -1.0787 -0.2939 -0.4045 0.1667  0.3555  0.7483  0   0
6   12  -0.9708 -0.2939 -0.4045 0.2000  0.4327  0.0869  1   1
7   12  -0.8629 -0.2939 -0.4045 0.2333  0.5159  0.6516  0   0
8   12  -0.7551 -0.2939 -0.4045 0.2667  0.6024  0.2773  0   1
9   12  -0.6472 -0.2939 -0.4045 0.3000  0.6891  0.2684  1   1
10  12  -0.5393 -0.2939 -0.4045 0.3333  0.7722  0.0750  1   1
11  12  -0.4315 -0.2939 -0.4045 0.3667  0.8475  0.9712  0   0
12  12  -0.3236 -0.2939 -0.4045 0.4000  0.9111  0.3411  1   1
13  12  -0.2157 -0.2939 -0.4045 0.4333  0.9595  0.7759  0   1
14  12  -0.1079 -0.2939 -0.4045 0.4667  0.9897  0.0535  1   1
15  12  0.0000  -0.2939 -0.4045 0.5000  1.0000  0.5143  0   1
16  12  0.1079  -0.2939 -0.4045 0.5333  0.9897  0.1089  1   1
17  12  0.2157  -0.2939 -0.4045 0.5667  0.9595  0.7901  0   1
18  12  0.3236  -0.2939 -0.4045 0.6000  0.9111  0.4829  1   1
19  12  0.4315  -0.2939 -0.4045 0.6333  0.8475  0.7112  0   1
20  12  0.5393  -0.2939 -0.4045 0.6667  0.7722  0.7360  0   1
21  12  0.6472  -0.2939 -0.4045 0.7000  0.6891  0.7628  0   0
22  12  0.7551  -0.2939 -0.4045 0.7333  0.6024  0.7882  0   0
23  12  0.8629  -0.2939 -0.4045 0.7667  0.5159  0.8520  0   0
24  12  0.9708  -0.2939 -0.4045 0.8000  0.4327  0.1451  1   1
25  12  1.0787  -0.2939 -0.4045 0.8333  0.3555  0.1195  1   1
26  12  1.1865  -0.2939 -0.4045 0.8667  0.2861  0.1347  1   1
27  12  1.2944  -0.2939 -0.4045 0.9000  0.2255  0.9169  0   0
28  12  1.4023  -0.2939 -0.4045 0.9333  0.1741  0.8072  1   0
29  12  1.5101  -0.2939 -0.4045 0.9667  0.1317  0.0046  1   1
30  12  1.6180  -0.2939 -0.4045 1.0000  0.0976  0.1524  1   0

0   13  -1.6180 -0.4045 -0.2939 0.0000  0.0976  0.9145  0   0
1   13  -1.5101 -0.4045 -0.2939 0.0333  0.1317  0.6171  0   0
2   13  -1.4023 -0.4045 -0.2939 0.0667  0.1741  0.5993  0   0
3   13  -1.2944 -0.4045 -0.2939 0.1000  0.2255  0.2365  0   0
4   13  -1.1865 -0.4045 -0.2939 0.1333  0.2861  0.7526  0   0
5   13  -1.0787 -0.4045 -0.2939 0.1667  0.3555  0.8587  0   0
6   13  -0.9708 -0.4045 -0.2939 0.2000  0.4327  0.9646  0   0
7   13  -0.8629 -0.4045 -0.2939 0.2333  0.5159  0.6462  0   0
8   13  -0.7551 -0.4045 -0.2939 0.2667  0.6024  0.0926  1   1
9   13  -0.6472 -0.4045 -0.2939 0.3000  0.6891  0.4848  0   1
10  13  -0.5393 -0.4045 -0.2939 0.3333  0.7722  0.2648  1   1
11  13  -0.4315 -0.4045 -0.2939 0.3667  0.8475  0.7153  0   1
12  13  -0.3236 -0.4045 -0.2939 0.4000  0.9111  0.5722  0   1
13  13  -0.2157 -0.4045 -0.2939 0.4333  0.9595  0.8676  0   1
14  13  -0.1079 -0.4045 -0.2939 0.4667  0.9897  0.8804  0   1
15  13  0.0000  -0.4045 -0.2939 0.5000  1.0000  0.2932  1   1
16  13  0.1079  -0.4045 -0.2939 0.5333  0.9897  0.4146  1   1
17  13  0.2157  -0.4045 -0.2939 0.5667  0.9595  0.8048  0   1
18  13  0.3236  -0.4045 -0.2939 0.6000  0.9111  0.6357  0   1
19  13  0.4315  -0.4045 -0.2939 0.6333  0.8475  0.8552  0   0
20  13  0.5393  -0.4045 -0.2939 0.6667  0.7722  0.1026  1   1
21  13  0.6472  -0.4045 -0.2939 0.7000  0.6891  0.9061  0   0
22  13  0.7551  -0.4045 -0.2939 0.7333  0.6024  0.9967  0   0
23  13  0.8629  -0.4045 -0.2939 0.7667  0.5159  0.5507  1   0
24  13  0.9708  -0.4045 -0.2939 0.8000  0.4327  0.2967  1   1
25  13  1.0787  -0.4045 -0.2939 0.8333  0.3555  0.5219  1   0
26  13  1.1865  -0.4045 -0.2939 0.8667  0.2861  0.6626  1   0
27  13  1.2944  -0.4045 -0.2939 0.9000  0.2255  0.5084  1   0
28  13  1.4023  -0.4045 -0.2939 0.9333  0.1741  0.1792  1   0
29  13  1.5101  -0.4045 -0.2939 0.9667  0.1317  0.4082  1   0
30  13  1.6180  -0.4045 -0.2939 1.0000  0.0976  0.4027  1   0
\end{filecontents}
\documentclass[border=5pt,varwidth]{standalone}
\usepackage{pgfplots}
    \pgfplotsset{
        % use `compat' level 1.8 or above to have a tight bounding box
        % also when axes are hidden
        compat=1.8,
        % define a custom colormap to provide the two colors for 0 and 1 values
        colormap={CM}{
            color=(green)
            color=(red)
        },
        % because I the "linear" and the "gauss"ian solution I put the style
        % stuff here, so I don't have to repeat it for both figures
        my axis style/.style={
            xmin=-1.618,
            xmax=1.618,
            ymin=-4,
            ymax=4,
            zmin=-4,
            zmax=4,
            hide axis,
            % add `z buffer' to remove the "spurious" hidden top segments
            z buffer=sort,
        },
        my addplot style/.style={
            surf,
            line join=round,
            % use shader `flat corner' so each segment color is just
            % provided by the corresponding corner value
            % (instead of the mean value of the four corners)
            shader=flat corner,
            draw=black,
            % state the `meta' values `explicit'ly
            point meta=explicit,
        },
        my table style/.style={
            /pgfplots/table/.cd,
                x=x,
                y=y,
                z=z,
        },
    }
\begin{document}
    \begin{tikzpicture}
        \begin{axis}[my axis style]
            \addplot3 [my addplot style] table [
                my table style,
                meta=line_prob,
            ] {Tube.txt};
        \end{axis}
    \end{tikzpicture}

    \begin{tikzpicture}
        \begin{axis}[my axis style]
            \addplot3 [my addplot style] table [
                my table style,
                meta=gauss_prob,
            ] {Tube.txt};
        \end{axis}
    \end{tikzpicture}
\end{document}

image showing the result of above code


Edit

And here the result using 120x80 samples and adding ultra thin to the my addplot style style (otherwise the filled area is very small because of the relatively thick line width) using LuaLaTeX to compile it without an "out of memory" error.

image of above code but with 120*80 samples

Stefan Pinnow
  • 29,535
  • If I mess with Tube.txt, I get only black lines. I wanted to increase the domain of x, rename some of the columns, get rid of "prob_line", change the function to something other than a gaussian (and recalculate the probability appropriately) and add the missing values of j, and now I'm getting this: link This happens regardless of whether I generate Tube.txt link with code in the .tex file or some other way. Here's my .tex file: link What am I doing wrong? – Rain Nov 27 '16 at 16:59
  • Also, if I want to have a "fine-grain" tube (e.g. using 120x80 samples instead of 30x20), I get the following error: ! TeX capacity exceeded, sorry [main memory size=5000000]. How can I assign more memory to TeX? – Rain Nov 27 '16 at 17:14
  • The simplest way would be to use LuaLaTeX. If you cannot or don't want to use it for your main document where this image should be used in, then you can externalize the plot using PGFPlots external library and then incorporate the externalized image in your main document. – Stefan Pinnow Nov 27 '16 at 18:13
  • I'm using XeLaTeX in order for some other code in my preamble to run properly. I don't have a compiler that works with LuaLaTeX; I found a website with a bunch of compilers after a quick search on TeX.SE, but the only one which the site explicitly says runs on Mac (I'm on a Mac) can't run on my computer for some reason. I'm too tired to work it out at the moment, but thanks. Anyway, leaving the number of samples alone for th moment, do you have any idea why my compiler cold be drawing only black lines as soon as I modify Tube.txt in any way? By the way, thanks for all your help. :) – Rain Nov 28 '16 at 02:43
  • For the first: If you are using MiKTeX or TeXLive you should have LuaLaTeX. Do you have one of those? You could test it, when you write lualatex --version in the console/command prompt. For the second: That really is too little information. Could you ask a follow-up question and state there, what exactly you changed and post an image of the corresponding output? Then there should be a high chance that I/we can help you. – Stefan Pinnow Nov 28 '16 at 06:59
  • MikTeX is for Windows only. I have TeXLive for Mac (I use TeXShop 3.51), but I can't see LuaLaTeX in the dropdown menu; if I type lualatex --version into the console after attempting a compilation, nothing happens. (Please forgive my ignorance; I know my (La)TeX code and all, but I know nothing about the inner workings of the compiler or about the differences between Lua-, Xe- and LaTeX.) – Rain Nov 28 '16 at 19:45
  • Sorry, but then I cannot help you, because I am a MiKTeX user and use WinEdt as editor ... But I found http://tex.stackexchange.com/questions/164615. Maybe that helps. Otherwise you could ask another question on how to use LuaLaTeX in TeXshop. I wish you best of luck! – Stefan Pinnow Nov 28 '16 at 19:55
  • Ah, yes, that works wonders, and LuaLaTeX can indeed compile that without running out of memory. Thanks! – Rain Nov 28 '16 at 22:13