![PGFPlots 中非线性色彩图的自定义函数和随机数](https://linux22.com/image/344825/PGFPlots%20%E4%B8%AD%E9%9D%9E%E7%BA%BF%E6%80%A7%E8%89%B2%E5%BD%A9%E5%9B%BE%E7%9A%84%E8%87%AA%E5%AE%9A%E4%B9%89%E5%87%BD%E6%95%B0%E5%92%8C%E9%9A%8F%E6%9C%BA%E6%95%B0.png)
我正在尝试创建一个类似于图 1 的图形这张纸。我知道如何使用 PGFPlots 制作圆柱体,但我对 3D 图还不熟悉,而且我还没有掌握色彩图的艺术(而且谷歌搜索了几次都没有找到有用的信息,而且有些东西对我来说似乎太高级了)。基本上,我想做的是:
- 将函数(例如 e^(-x^2) 或 1/(1+cosh(x)) 等)定义为包络
- 要求 PGFPlots 生成 0 到 1 之间的随机数,其分布由之前定义的包络函数给出
- 使用上面生成的随机数集合为圆柱体着色:每个随机数可以是圆柱体网格定义的小矩形之一为某种颜色(例如红色)而不是另一种颜色(例如绿色)的概率,因此红点的密度大致等于包络函数
编辑:我制作了一张图来说明我试图通过步骤 2 和 3 实现的目标。有三个圆柱体。顶部的圆柱体显示网格;圆柱体被网格分成小矩形。中间和底部的圆柱体被着色,使得红色方块的密度是圆柱体上位置的函数(参见圆柱体旁边的小手绘图):在第一种情况下,密度是线性的,而在第二种情况下,密度大致呈高斯分布。哪个各个矩形被涂成红色是随机的(我认为生成一个由 0 和 1 组成的随机矩阵应该可以解决问题),但密度函数(即上面第 1 步中定义的函数)决定多少矩形在每个值处都涂成红色X,X是沿圆柱体的位置(或者换句话说,随机矩阵的每一列中有多少个 1,它是列索引的函数)。希望这样说更清楚。
这是我的 MWE(我使用的是 hot2 色彩图,但显然这会改变):
\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}
谢谢!
答案1
也许有一种方法可以在 LaTeX/PGFPlots 中完成所有这些操作,但我认为最好的方法是使用适当的工具计算所需的值,将数据导出到表中,然后使用该表进行绘图。
我已经在 Excel 中完成了所有计算,但不幸的是,由于每个答案允许的字符数有限,因此无法在此处列出整个表格。这就是为什么表格仅列出部分内容的原因。
计算的思路是计算要使用的函数的“标准化”值,其中“标准化”的意思是,结果值应在 0 到 1 之间。然后在每行中创建 0 到 1 之间的随机数。最后,只需将函数值与随机值进行比较,当随机数小于或等于函数值时返回 1,否则返回 0。
有关 PGFPlots 的更多详细信息,请查看代码中的注释。
% 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}
编辑
ultra thin
这里是使用 120x80 样本并添加到样式的结果my addplot style
(否则由于线宽相对较粗,填充区域非常小),使用 LuaLaTeX 进行编译而不会出现“内存不足”错误。