越来越少
越来越少
这家伙很懒,什么也没写!

注册于 5年前

回答
33
文章
0
关注者
1

%\usepackage{pgfplots}
\begin{tikzpicture}
\begin{axis}[
view/az=120,
axis lines=center,
axis on top,
axis equal=true,
enlarge x limits,
trig format plots=rad,
xlabel=$x$,ylabel=$y$,zlabel=$z$,
colormap/viridis,
%shader=interp,
]
\addplot3 [
surf,
samples=50,
samples y=20,
domain=-pi/2:pi/2,
domain y=0:1
] ({sin(x)},{cos(x)},y);
\end{axis}
\end{tikzpicture}

ffa16be897476fd41f89978ef020d082.png

TikZ 的 fill 用于二维的填充,默认采用 /tikz/nonzero rule 这个规则来判断图形的内部。你填充的路径是用三维坐标构造的,但 TikZ 会把它转换为二维路径,再做填充。

我能想到的思路是,先做一个有空缺的段落,然后把一个盒子放到空缺处,整个段落最好位于一个页面上。

建议参考

  1. shapepar, rjlpshap 宏包,
  2. 链接\cutout 命令
  3. The TeXbook 的 101 页
  4. tikz 的 /tikz/remember picture 选项以及相关内容

整个过程可能比较麻烦。

参照手册的例子,把你的数据保存为文件 datafile.dat, 然后

\pgfplotstableread{datafile.dat}\datatable
\begin{tikzpicture}
\begin{axis}[
  view={160}{45},
  colorbar horizontal]
\addplot3 [
  mesh/ordering=y varies,
  mesh/rows=48,
  contour filled={
    number=40,
    handler/.style=smooth,
  }]
table {\datatable};
\end{axis}
\end{tikzpicture}

得到

37504f29de5bc781cd0e9ed39316a888.png

你的数据没有 scanline, 而且是先让 y 变量变化,再让 x 变量变化,所以需要参考以下选项

/pgfplots/mesh/rows
/pgfplots/mesh/cols
/pgfplots/mesh/ordering
/pgfplots/mesh/num points

发布
问题