使用 Matlab 数据、pgfplots 填充轮廓

使用 Matlab 数据、pgfplots 填充轮廓

我正在使用contour prepared format=matlab绘制轮廓,如pgfplots手册中建议的那样,但我无法将其与选项结合使用contour filled。我已将 C 数据从 修改为[C,h]=contourf使用contour prepared format=standard,但仍然无法将其与 结合使用。当我单独contour filled使用时,它似乎无法理解我的数据。我想知道一种使用 Matlab 轮廓数据绘制填充轮廓的方法。为了说明,下面有一个简单的例子,一个抛物面,轮廓未填充。contour filledpgfplots.dat

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5}

\begin{filecontents}{example.dat}
      7.2727273e-01   2.9000000e+01
   3.8636364e-01  -7.5000000e-01
   2.5000000e-01  -8.0844156e-01
   0.0000000e+00  -8.4415584e-01
  -2.5000000e-01  -8.0844156e-01
  -3.8636364e-01  -7.5000000e-01
  -5.0000000e-01  -6.8181818e-01
  -6.8181818e-01  -5.0000000e-01
  -7.5000000e-01  -3.8636364e-01
  -8.0844156e-01  -2.5000000e-01
  -8.4415584e-01   0.0000000e+00
  -8.0844156e-01   2.5000000e-01
  -7.5000000e-01   3.8636364e-01
  -6.8181818e-01   5.0000000e-01
  -5.0000000e-01   6.8181818e-01
  -3.8636364e-01   7.5000000e-01
  -2.5000000e-01   8.0844156e-01
   0.0000000e+00   8.4415584e-01
   2.5000000e-01   8.0844156e-01
   3.8636364e-01   7.5000000e-01
   5.0000000e-01   6.8181818e-01
   6.8181818e-01   5.0000000e-01
   7.5000000e-01   3.8636364e-01
   8.0844156e-01   2.5000000e-01
   8.4415584e-01   0.0000000e+00
   8.0844156e-01  -2.5000000e-01
   7.5000000e-01  -3.8636364e-01
   6.8181818e-01  -5.0000000e-01
   5.0000000e-01  -6.8181818e-01
   3.8636364e-01  -7.5000000e-01
   1.4545455e+00   3.7000000e+01
   6.6363636e-01  -1.0000000e+00
   5.0000000e-01  -1.0909091e+00
   2.5000000e-01  -1.1742424e+00
   0.0000000e+00  -1.2020202e+00
  -2.5000000e-01  -1.1742424e+00
  -5.0000000e-01  -1.0909091e+00
  -6.6363636e-01  -1.0000000e+00
  -7.5000000e-01  -9.3831169e-01
  -9.3831169e-01  -7.5000000e-01
  -1.0000000e+00  -6.6363636e-01
  -1.0909091e+00  -5.0000000e-01
  -1.1742424e+00  -2.5000000e-01
  -1.2020202e+00   0.0000000e+00
  -1.1742424e+00   2.5000000e-01
  -1.0909091e+00   5.0000000e-01
  -1.0000000e+00   6.6363636e-01
  -9.3831169e-01   7.5000000e-01
  -7.5000000e-01   9.3831169e-01
  -6.6363636e-01   1.0000000e+00
  -5.0000000e-01   1.0909091e+00
  -2.5000000e-01   1.1742424e+00
   0.0000000e+00   1.2020202e+00
   2.5000000e-01   1.1742424e+00
   5.0000000e-01   1.0909091e+00
   6.6363636e-01   1.0000000e+00
   7.5000000e-01   9.3831169e-01
   9.3831169e-01   7.5000000e-01
   1.0000000e+00   6.6363636e-01
   1.0909091e+00   5.0000000e-01
   1.1742424e+00   2.5000000e-01
   1.2020202e+00   0.0000000e+00
   1.1742424e+00  -2.5000000e-01
   1.0909091e+00  -5.0000000e-01
   1.0000000e+00  -6.6363636e-01
   9.3831169e-01  -7.5000000e-01
   7.5000000e-01  -9.3831169e-01
   6.6363636e-01  -1.0000000e+00
   2.1818182e+00   4.5000000e+01
   7.8246753e-01  -1.2500000e+00
   7.5000000e-01  -1.2706612e+00
   5.0000000e-01  -1.3842975e+00
   2.5000000e-01  -1.4524793e+00
   0.0000000e+00  -1.4752066e+00
  -2.5000000e-01  -1.4524793e+00
  -5.0000000e-01  -1.3842975e+00
  -7.5000000e-01  -1.2706612e+00
  -7.8246753e-01  -1.2500000e+00
  -1.0000000e+00  -1.0808081e+00
  -1.0808081e+00  -1.0000000e+00
  -1.2500000e+00  -7.8246753e-01
  -1.2706612e+00  -7.5000000e-01
  -1.3842975e+00  -5.0000000e-01
  -1.4524793e+00  -2.5000000e-01
  -1.4752066e+00   0.0000000e+00
  -1.4524793e+00   2.5000000e-01
  -1.3842975e+00   5.0000000e-01
  -1.2706612e+00   7.5000000e-01
  -1.2500000e+00   7.8246753e-01
  -1.0808081e+00   1.0000000e+00
  -1.0000000e+00   1.0808081e+00
  -7.8246753e-01   1.2500000e+00
  -7.5000000e-01   1.2706612e+00
  -5.0000000e-01   1.3842975e+00
  -2.5000000e-01   1.4524793e+00
   0.0000000e+00   1.4752066e+00
   2.5000000e-01   1.4524793e+00
   5.0000000e-01   1.3842975e+00
   7.5000000e-01   1.2706612e+00
   7.8246753e-01   1.2500000e+00
   1.0000000e+00   1.0808081e+00
   1.0808081e+00   1.0000000e+00
   1.2500000e+00   7.8246753e-01
   1.2706612e+00   7.5000000e-01
   1.3842975e+00   5.0000000e-01
   1.4524793e+00   2.5000000e-01
   1.4752066e+00   0.0000000e+00
   1.4524793e+00  -2.5000000e-01
   1.3842975e+00  -5.0000000e-01
   1.2706612e+00  -7.5000000e-01
   1.2500000e+00  -7.8246753e-01
   1.0808081e+00  -1.0000000e+00
   1.0000000e+00  -1.0808081e+00
   7.8246753e-01  -1.2500000e+00
   2.9090909e+00   5.3000000e+01
   8.0519481e-01  -1.5000000e+00
   7.5000000e-01  -1.5297203e+00
   5.0000000e-01  -1.6258741e+00
   2.5000000e-01  -1.6835664e+00
   0.0000000e+00  -1.7027972e+00
  -2.5000000e-01  -1.6835664e+00
  -5.0000000e-01  -1.6258741e+00
  -7.5000000e-01  -1.5297203e+00
  -8.0519481e-01  -1.5000000e+00
  -1.0000000e+00  -1.3760331e+00
  -1.1540404e+00  -1.2500000e+00
  -1.2500000e+00  -1.1540404e+00
  -1.3760331e+00  -1.0000000e+00
  -1.5000000e+00  -8.0519481e-01
  -1.5297203e+00  -7.5000000e-01
  -1.6258741e+00  -5.0000000e-01
  -1.6835664e+00  -2.5000000e-01
  -1.7027972e+00   0.0000000e+00
  -1.6835664e+00   2.5000000e-01
  -1.6258741e+00   5.0000000e-01
  -1.5297203e+00   7.5000000e-01
  -1.5000000e+00   8.0519481e-01
  -1.3760331e+00   1.0000000e+00
  -1.2500000e+00   1.1540404e+00
  -1.1540404e+00   1.2500000e+00
  -1.0000000e+00   1.3760331e+00
  -8.0519481e-01   1.5000000e+00
  -7.5000000e-01   1.5297203e+00
  -5.0000000e-01   1.6258741e+00
  -2.5000000e-01   1.6835664e+00
   0.0000000e+00   1.7027972e+00
   2.5000000e-01   1.6835664e+00
   5.0000000e-01   1.6258741e+00
   7.5000000e-01   1.5297203e+00
   8.0519481e-01   1.5000000e+00
   1.0000000e+00   1.3760331e+00
   1.1540404e+00   1.2500000e+00
   1.2500000e+00   1.1540404e+00
   1.3760331e+00   1.0000000e+00
   1.5000000e+00   8.0519481e-01
   1.5297203e+00   7.5000000e-01
   1.6258741e+00   5.0000000e-01
   1.6835664e+00   2.5000000e-01
   1.7027972e+00   0.0000000e+00
   1.6835664e+00  -2.5000000e-01
   1.6258741e+00  -5.0000000e-01
   1.5297203e+00  -7.5000000e-01
   1.5000000e+00  -8.0519481e-01
   1.3760331e+00  -1.0000000e+00
   1.2500000e+00  -1.1540404e+00
   1.1540404e+00  -1.2500000e+00
   1.0000000e+00  -1.3760331e+00
   8.0519481e-01  -1.5000000e+00
   3.6363636e+00   6.1000000e+01
   7.5649351e-01  -1.7500000e+00
   7.5000000e-01  -1.7530303e+00
   5.0000000e-01  -1.8363636e+00
   2.5000000e-01  -1.8863636e+00
   0.0000000e+00  -1.9030303e+00
  -2.5000000e-01  -1.8863636e+00
  -5.0000000e-01  -1.8363636e+00
  -7.5000000e-01  -1.7530303e+00
  -7.5649351e-01  -1.7500000e+00
  -1.0000000e+00  -1.6188811e+00
  -1.1717172e+00  -1.5000000e+00
  -1.2500000e+00  -1.4359504e+00
  -1.4359504e+00  -1.2500000e+00
  -1.5000000e+00  -1.1717172e+00
  -1.6188811e+00  -1.0000000e+00
  -1.7500000e+00  -7.5649351e-01
  -1.7530303e+00  -7.5000000e-01
  -1.8363636e+00  -5.0000000e-01
  -1.8863636e+00  -2.5000000e-01
  -1.9030303e+00   0.0000000e+00
  -1.8863636e+00   2.5000000e-01
  -1.8363636e+00   5.0000000e-01
  -1.7530303e+00   7.5000000e-01
  -1.7500000e+00   7.5649351e-01
  -1.6188811e+00   1.0000000e+00
  -1.5000000e+00   1.1717172e+00
  -1.4359504e+00   1.2500000e+00
  -1.2500000e+00   1.4359504e+00
  -1.1717172e+00   1.5000000e+00
  -1.0000000e+00   1.6188811e+00
  -7.5649351e-01   1.7500000e+00
  -7.5000000e-01   1.7530303e+00
  -5.0000000e-01   1.8363636e+00
  -2.5000000e-01   1.8863636e+00
   0.0000000e+00   1.9030303e+00
   2.5000000e-01   1.8863636e+00
   5.0000000e-01   1.8363636e+00
   7.5000000e-01   1.7530303e+00
   7.5649351e-01   1.7500000e+00
   1.0000000e+00   1.6188811e+00
   1.1717172e+00   1.5000000e+00
   1.2500000e+00   1.4359504e+00
   1.4359504e+00   1.2500000e+00
   1.5000000e+00   1.1717172e+00
   1.6188811e+00   1.0000000e+00
   1.7500000e+00   7.5649351e-01
   1.7530303e+00   7.5000000e-01
   1.8363636e+00   5.0000000e-01
   1.8863636e+00   2.5000000e-01
   1.9030303e+00   0.0000000e+00
   1.8863636e+00  -2.5000000e-01
   1.8363636e+00  -5.0000000e-01
   1.7530303e+00  -7.5000000e-01
   1.7500000e+00  -7.5649351e-01
   1.6188811e+00  -1.0000000e+00
   1.5000000e+00  -1.1717172e+00
   1.4359504e+00  -1.2500000e+00
   1.2500000e+00  -1.4359504e+00
   1.1717172e+00  -1.5000000e+00
   1.0000000e+00  -1.6188811e+00
   7.5649351e-01  -1.7500000e+00
   4.3636364e+00   1.2000000e+01
  -5.9090909e-01  -2.0000000e+00
  -7.5000000e-01  -1.9469697e+00
  -1.0000000e+00  -1.8303030e+00
  -1.1338384e+00  -1.7500000e+00
  -1.2500000e+00  -1.6695804e+00
  -1.4504132e+00  -1.5000000e+00
  -1.5000000e+00  -1.4504132e+00
  -1.6695804e+00  -1.2500000e+00
  -1.7500000e+00  -1.1338384e+00
  -1.8303030e+00  -1.0000000e+00
  -1.9469697e+00  -7.5000000e-01
  -2.0000000e+00  -5.9090909e-01
   4.3636364e+00   1.2000000e+01
   2.0000000e+00  -5.9090909e-01
   1.9469697e+00  -7.5000000e-01
   1.8303030e+00  -1.0000000e+00
   1.7500000e+00  -1.1338384e+00
   1.6695804e+00  -1.2500000e+00
   1.5000000e+00  -1.4504132e+00
   1.4504132e+00  -1.5000000e+00
   1.2500000e+00  -1.6695804e+00
   1.1338384e+00  -1.7500000e+00
   1.0000000e+00  -1.8303030e+00
   7.5000000e-01  -1.9469697e+00
   5.9090909e-01  -2.0000000e+00
   4.3636364e+00   1.2000000e+01
  -2.0000000e+00   5.9090909e-01
  -1.9469697e+00   7.5000000e-01
  -1.8303030e+00   1.0000000e+00
  -1.7500000e+00   1.1338384e+00
  -1.6695804e+00   1.2500000e+00
  -1.5000000e+00   1.4504132e+00
  -1.4504132e+00   1.5000000e+00
  -1.2500000e+00   1.6695804e+00
  -1.1338384e+00   1.7500000e+00
  -1.0000000e+00   1.8303030e+00
  -7.5000000e-01   1.9469697e+00
  -5.9090909e-01   2.0000000e+00
   4.3636364e+00   1.2000000e+01
   5.9090909e-01   2.0000000e+00
   7.5000000e-01   1.9469697e+00
   1.0000000e+00   1.8303030e+00
   1.1338384e+00   1.7500000e+00
   1.2500000e+00   1.6695804e+00
   1.4504132e+00   1.5000000e+00
   1.5000000e+00   1.4504132e+00
   1.6695804e+00   1.2500000e+00
   1.7500000e+00   1.1338384e+00
   1.8303030e+00   1.0000000e+00
   1.9469697e+00   7.5000000e-01
   2.0000000e+00   5.9090909e-01
   5.0909091e+00   8.0000000e+00
  -1.0404040e+00  -2.0000000e+00
  -1.2500000e+00  -1.8742424e+00
  -1.4194215e+00  -1.7500000e+00
  -1.5000000e+00  -1.6818182e+00
  -1.6818182e+00  -1.5000000e+00
  -1.7500000e+00  -1.4194215e+00
  -1.8742424e+00  -1.2500000e+00
  -2.0000000e+00  -1.0404040e+00
   5.0909091e+00   8.0000000e+00
   2.0000000e+00  -1.0404040e+00
   1.8742424e+00  -1.2500000e+00
   1.7500000e+00  -1.4194215e+00
   1.6818182e+00  -1.5000000e+00
   1.5000000e+00  -1.6818182e+00
   1.4194215e+00  -1.7500000e+00
   1.2500000e+00  -1.8742424e+00
   1.0404040e+00  -2.0000000e+00
   5.0909091e+00   8.0000000e+00
  -2.0000000e+00   1.0404040e+00
  -1.8742424e+00   1.2500000e+00
  -1.7500000e+00   1.4194215e+00
  -1.6818182e+00   1.5000000e+00
  -1.5000000e+00   1.6818182e+00
  -1.4194215e+00   1.7500000e+00
  -1.2500000e+00   1.8742424e+00
  -1.0404040e+00   2.0000000e+00
   5.0909091e+00   8.0000000e+00
   1.0404040e+00   2.0000000e+00
   1.2500000e+00   1.8742424e+00
   1.4194215e+00   1.7500000e+00
   1.5000000e+00   1.6818182e+00
   1.6818182e+00   1.5000000e+00
   1.7500000e+00   1.4194215e+00
   1.8742424e+00   1.2500000e+00
   2.0000000e+00   1.0404040e+00
   5.8181818e+00   6.0000000e+00
  -1.3429752e+00  -2.0000000e+00
  -1.5000000e+00  -1.8848485e+00
  -1.6555944e+00  -1.7500000e+00
  -1.7500000e+00  -1.6555944e+00
  -1.8848485e+00  -1.5000000e+00
  -2.0000000e+00  -1.3429752e+00
   5.8181818e+00   6.0000000e+00
   2.0000000e+00  -1.3429752e+00
   1.8848485e+00  -1.5000000e+00
   1.7500000e+00  -1.6555944e+00
   1.6555944e+00  -1.7500000e+00
   1.5000000e+00  -1.8848485e+00
   1.3429752e+00  -2.0000000e+00
   5.8181818e+00   6.0000000e+00
  -2.0000000e+00   1.3429752e+00
  -1.8848485e+00   1.5000000e+00
  -1.7500000e+00   1.6555944e+00
  -1.6555944e+00   1.7500000e+00
  -1.5000000e+00   1.8848485e+00
  -1.3429752e+00   2.0000000e+00
   5.8181818e+00   6.0000000e+00
   1.3429752e+00   2.0000000e+00
   1.5000000e+00   1.8848485e+00
   1.6555944e+00   1.7500000e+00
   1.7500000e+00   1.6555944e+00
   1.8848485e+00   1.5000000e+00
   2.0000000e+00   1.3429752e+00
   6.5454545e+00   4.0000000e+00
  -1.5909091e+00  -2.0000000e+00
  -1.7500000e+00  -1.8621212e+00
  -1.8621212e+00  -1.7500000e+00
  -2.0000000e+00  -1.5909091e+00
   6.5454545e+00   4.0000000e+00
   2.0000000e+00  -1.5909091e+00
   1.8621212e+00  -1.7500000e+00
   1.7500000e+00  -1.8621212e+00
   1.5909091e+00  -2.0000000e+00
   6.5454545e+00   4.0000000e+00
  -2.0000000e+00   1.5909091e+00
  -1.8621212e+00   1.7500000e+00
  -1.7500000e+00   1.8621212e+00
  -1.5909091e+00   2.0000000e+00
   6.5454545e+00   4.0000000e+00
   1.5909091e+00   2.0000000e+00
   1.7500000e+00   1.8621212e+00
   1.8621212e+00   1.7500000e+00
   2.0000000e+00   1.5909091e+00
   7.2727273e+00   2.0000000e+00
  -1.8060606e+00  -2.0000000e+00
  -2.0000000e+00  -1.8060606e+00
   7.2727273e+00   2.0000000e+00
   2.0000000e+00  -1.8060606e+00
   1.8060606e+00  -2.0000000e+00
   7.2727273e+00   2.0000000e+00
  -2.0000000e+00   1.8060606e+00
  -1.8060606e+00   2.0000000e+00
   7.2727273e+00   2.0000000e+00
   1.8060606e+00   2.0000000e+00
   2.0000000e+00   1.8060606e+00
\end{filecontents}

\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot [
    contour prepared={labels=false},
    contour prepared format=matlab,
] 
table {example.dat};
\end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

.dat文件兼容contour prepared format=matlabhttps://pastebin.com/Cmgvwy8z

相关内容