根据数据点绘制三维曲面

根据数据点绘制三维曲面

我有以下代码,它运行良好并生成我想要的图。就是这样:

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots, filecontents}

\begin{filecontents*}{filename.txt}
0 0 -0.64
1 0 -0.5
2 0 -0.4
3 0 -0.31
4 0 -0.23
5 0 -0.2
6 0 -0.24
7 0 -0.32
8 0 -0.42
9 0 -0.59
10 0 -0.76

0 1 -0.54
1 1 -0.4
2 1 -0.27
3 1 -0.17
4 1 -0.08
5 1 -0.03
6 1 -0.05
7 1 -0.14
8 1 -0.27
9 1 -0.45
10 1 -0.63

0 2 -0.46
1 2 -0.31
2 2 -0.16
3 2 -0.03
4 2 0.07
5 2 0.12
6 2 0.11
7 2 0.02
8 2 -0.13
9 2 -0.32
10 2 -0.51

0 3 -0.44
1 3 -0.26
2 3 -0.08
3 3 0.07
4 3 0.18
5 3 0.25
6 3 0.24
7 3 0.14
8 3 -0.01
9 3 -0.2
10 3 -0.41

0 4 -0.44
1 4 -0.26
2 4 -0.04
3 4 0.13
4 4 0.25
5 4 0.32
6 4 0.31
7 4 0.22
8 4 0.07
9 4 -0.14
10 4 -0.37

0 5 -0.44
1 5 -0.26
2 5 -0.05
3 5 0.14
4 5 0.27
5 5 0.34
6 5 0.33
7 5 0.24
8 5 0.09
9 5 -0.12
10 5 -0.36

0 6 -0.48
1 6 -0.29
2 6 -0.08
3 6 0.09
4 6 0.22
5 6 0.29
6 6 0.28
7 6 0.2
8 6 0.06
9 6 -0.13
10 6 -0.35

0 7 -0.55
1 7 -0.34
2 7 -0.15
3 7 -0.0
4 7 0.11
5 7 0.18
6 7 0.18
7 7 0.11
8 7 -0.02
9 7 -0.2
10 7 -0.39

0 8 -0.63
1 8 -0.44
2 8 -0.27
3 8 -0.13
4 8 -0.03
5 8 0.04
6 8 0.04
7 8 -0.02
8 8 -0.13
9 8 -0.29
10 8 -0.45

0 9 -0.71
1 9 -0.59
2 9 -0.43
3 9 -0.28
4 9 -0.18
5 9 -0.13
6 9 -0.13
7 9 -0.17
8 9 -0.26
9 9 -0.38
10 9 -0.53

0 10 -0.83
1 10 -0.75
2 10 -0.59
3 10 -0.45
4 10 -0.35
5 10 -0.3
6 10 -0.3
7 10 -0.34
8 10 -0.42
9 10 -0.52
10 10 -0.66
\end{filecontents*}

\begin{document}
  \begin{tikzpicture}
    \begin{axis}[view={-20}{20}, grid=both]
      \addplot3[surf] file {filename.txt};
      %\addplot3[surf, point meta=explicit] table [z expr=0.5, meta index=2] {filename.txt};
    \end{axis}
  \end{tikzpicture}
\end{document}

在此处输入图片描述

现在,我的数据点如下:

    \documentclass[border=5mm]{standalone}
\usepackage{pgfplots, filecontents}

\begin{filecontents*}{filename.txt}

10  0   2.8637
15  0   2.8131
20  0   2.8727
25  0   2.8644
30  0   2.8842
35  0   2.8675
40  0   2.7089
45  0   2.6247

10  0.001   2.8436
15  0.001   2.8692
20  0.001   2.8859
25  0.001   2.4132
30  0.001   2.7664
35  0.001   2.8796
40  0.001   2.8752
45  0.001   2.8782

10  0.002   2.8752
15  0.002   2.8693
20  0.002   2.8703
25  0.002   2.6594
30  0.002   2.8643
35  0.002   2.5554
40  0.002   2.8875
45  0.002   2.8887

10  0.003   2.8151
15  0.003   2.8856
20  0.003   2.8701
25  0.003   2.857
30  0.003   2.8785
35  0.003   2.6176
40  0.003   2.8835
45  0.003   2.9234

10  0.004   2.8815
15  0.004   2.8792
20  0.004   2.8213
25  0.004   2.8877
30  0.004   2.9202
35  0.004   2.8595
40  0.004   2.885
45  0.004   2.8489

10  0.005   2.8907
15  0.005   2.8521
20  0.005   2.6148
25  0.005   2.8762
30  0.005   2.8576
35  0.005   2.8363
40  0.005   2.7048
45  0.005   2.7617

10  0.006   2.8599
15  0.006   2.8941
20  0.006   2.8474
25  0.006   2.876
30  0.006   2.8206
35  0.006   2.5735
40  0.006   2.3208
45  0.006   2.3754

10  0.007   2.8833
15  0.007   2.8886
20  0.007   2.8691
25  0.007   2.6355
30  0.007   2.7528
35  0.007   2.5829
40  0.007   2.583
45  0.007   2.5111

10  0.008   2.8711
15  0.008   2.8815
20  0.008   2.8452
25  0.008   2.7511
30  0.008   2.5907
35  0.008   2.5598
40  0.008   2.6029
45  0.008   2.5253

10  0.009   2.8708
15  0.009   2.6844
20  0.009   2.7038
25  0.009   2.6988
30  0.009   2.4988
35  0.009   2.4059
40  0.009   1.8292
45  0.009   2.2368

10  0.01    2.8806
15  0.01    2.8899
20  0.01    2.386
25  0.01    2.5372
30  0.01    2.3707
35  0.01    2.1165
40  0.01    2.1553
45  0.01    2.3411

10  0.011   2.8725
15  0.011   2.7136
20  0.011   2.5851
25  0.011   2.4942
30  0.011   2.478
35  0.011   2.3578
40  0.011   2.465
45  0.011   2.0726

10  0.012   2.8873
15  0.012   2.6652
20  0.012   2.6406
25  0.012   2.4053
30  0.012   2.3922
35  0.012   2.3308
40  0.012   2.3423
45  0.012   2.0778

10  0.013   2.8902
15  0.013   2.7437
20  0.013   2.6815
25  0.013   2.2707
30  0.013   2.1961
35  0.013   2.1585
40  0.013   2.2469
45  0.013   2.3896

10  0.014   2.8826
15  0.014   2.6679
20  0.014   2.4037
25  0.014   2.2751
30  0.014   2.3569
35  0.014   2.3838
40  0.014   2.2706
45  0.014   2.2171

10  0.015   2.8688
15  0.015   2.5697
20  0.015   2.4726
25  0.015   2.2542
30  0.015   2.344
35  0.015   2.3119
40  0.015   2.0676
45  0.015   2.2591

\end{filecontents*}

\begin{document}
    \begin{tikzpicture}
    \begin{axis}[view={-20}{35}, grid=both]
    \addplot3[surf] file {filename.txt};
%   \addplot3[surf, point meta=explicit] table [z expr=0.2, meta index=2] {filename.txt};
    \end{axis}
    \end{tikzpicture}
\end{document}

并引发以下灾难: 在此处输入图片描述

你能告诉我发生了什么吗?我该如何解决这个问题?我需要修复刻度盘上显示的10^-2. 我想要在 x 轴上从 0 到 0.015,步长为 0.001

这是所需的输出: 在此处输入图片描述

相关内容