我想制作 3D 动画,其中绘图数据在表格中。它们的顺序如下
\begin{filecontents}{AA}
x1 x2 x3 x4 x5 x6
0.1 0 0.4 0.1 0 0.4
0.3 0 0.12 0.3 2 1
...
\end{filecontents}
一个框架应该是第一列三元组,x1 x2 x3
另一个框架应该是x4 x5 x6
(作为x,y,z
)。
但我无法完成帧的索引。
\begin{animateinline}[controls, palindrome]{6} % frames per second
\multiframe{}{n=1+1}{ %frames with \n running
\begin{tikzpicture}
\begin{axis}[
ticks = none,
axis lines = middle]
\addplot3[smooth, ultra thin, mark=none] table[x=x\n, y=x2, z=x3] {AA};
\end{axis}
\end{tikzpicture}
}
\end{animateinline}
我尝试定义新的变量进行索引y
,z
但无法根据多帧变量计算它们\n
。
您能建议其他方法或者别的什么吗?
梅威瑟:
\documentclass{beamer}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{animate}
\usepackage{filecontents}
\begin{filecontents}{AA}
x1 x2 x3 x4 x5 x6
4.904580240000000 -2.974098630000000 -6.444943280000000 4.210292740000000 -2.873583600000000 -0.487057700000000
5.004457720000000 -3.509494060000000 -0.330922790000000 3.257552530000000 -3.117999570000000 7.631587500000000
3.675409580000000 -3.754664270000000 11.124269730000000 1.120766430000000 -2.882311810000000 13.433930159999999
0.816333360000000 -3.365484110000000 17.732776399999999 -1.118058130000000 -2.106595390000000 10.088750320000001
-1.976809280000000 -2.303012750000000 12.384788170000000 -2.401139500000000 -1.073269810000000 4.122039400000000
-3.504589980000000 -0.958277850000000 5.260611890000000 -2.837346870000000 -0.100669260000000 1.094804940000000
-4.063569710000000 0.288000330000000 2.238588260000000 -2.908293130000000 0.673806950000000 0.813779400000000
-4.265831590000000 1.296414800000000 2.483840180000000 -2.965784480000000 1.258517390000000 2.069885150000000
-4.500883010000000 2.095326500000000 4.129450120000000 -3.177693360000000 1.725889690000000 3.733646770000000
-4.831611350000000 2.763799770000000 4.736467900000000 -3.537237910000000 2.149235240000000 4.732940120000000
\end{filecontents}
\begin{document}
\begin{frame}{animate bifurcation}
\centering
\begin{animateinline}[controls, palindrome]{6} % frames per second
\multiframe{2}{n=1+1}{ %frames with \n running
\begin{tikzpicture}
\begin{axis}[
ticks = none,
axis lines = middle]
\addplot3[smooth, ultra thin, mark=none] table[x=x\n, y=x2, z=x3] {AA};
\end{axis}
\end{tikzpicture}
}
\end{animateinline}
\end{frame}
\end{document}
答案1
在的第二个参数中\multiframe
,可以根据需要定义任意多个参数:
\documentclass{beamer}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{animate}
\usepackage{filecontents}
\begin{filecontents}[overwrite,noheader]{AA.dat}
x1 x2 x3 x4 x5 x6
4.904580240000000 -2.974098630000000 -6.444943280000000 4.210292740000000 -2.873583600000000 -0.487057700000000
5.004457720000000 -3.509494060000000 -0.330922790000000 3.257552530000000 -3.117999570000000 7.631587500000000
3.675409580000000 -3.754664270000000 11.124269730000000 1.120766430000000 -2.882311810000000 13.433930159999999
0.816333360000000 -3.365484110000000 17.732776399999999 -1.118058130000000 -2.106595390000000 10.088750320000001
1.976809280000000 -2.303012750000000 12.384788170000000 -2.401139500000000 -1.073269810000000 4.122039400000000
3.504589980000000 -0.958277850000000 5.260611890000000 -2.837346870000000 -0.100669260000000 1.094804940000000
4.063569710000000 0.288000330000000 2.238588260000000 -2.908293130000000 0.673806950000000 0.813779400000000
4.265831590000000 1.296414800000000 2.483840180000000 -2.965784480000000 1.258517390000000 2.069885150000000
4.500883010000000 2.095326500000000 4.129450120000000 -3.177693360000000 1.725889690000000 3.733646770000000
4.831611350000000 2.763799770000000 4.736467900000000 -3.537237910000000 2.149235240000000 4.732940120000000
\end{filecontents}
\begin{document}
\begin{frame}{animate bifurcation}
\centering
\begin{animateinline}[controls, palindrome]{6} % frames per second
\multiframe{2}{nx=1+3,ny=2+3,nz=3+3}{ %frames with \n running
\begin{tikzpicture}
\begin{axis}[
xmin=-4,xmax=6,
ymin=-4,ymax=3,
zmin=-7,zmax=18,
ticks = none,
axis lines = middle]
\addplot3[smooth, ultra thin, mark=none] table[x=x\nx, y=x\ny, z=x\nz] {AA.dat};
\end{axis}
\end{tikzpicture}
}
\end{animateinline}
\end{frame}
\end{document}