如何使用 pgfplots 在 latex 中的 .csv 文件中选择一系列数据?

如何使用 pgfplots 在 latex 中的 .csv 文件中选择一系列数据?

我正在使用 latex 中的 pgfplots 生成数据图。我正在使用来自多个 excel 文件的数据作为 .csv。这是 MWE:

\documentclass[border=5mm,convert]{standalone}
\usepackage{pgfplots}
\usepackage{siunitx}
\usepgfplotslibrary{fillbetween}
\begin{document}


\begin{tikzpicture}
\begin{axis}[
%width=0.9\textwidth,
%height=6cm,
%title=This is my graph,
xlabel={Crosshead Extension $\Delta$ (\si{\milli\meter})},
ylabel={Load $F$ (\si{\newton})},
xmin=0.0,
ymin=0,
%grid=major,
]

 \addplot+ [smooth,mark=none,name path=boundary1] table [x=CH, y=L, col sep=comma] {ASTMe8Data/SpecimenS6.csv};
 \addplot+ [smooth,mark=none,name path=boundary2,] table [x=CH, y=L, col sep=comma] {ASTMe8Data/SpecimenS5.csv};
 \addplot+ [smooth,mark=none,name path=boundary3,] table [x=CH, y=L, col sep=comma] {ASTMe8Data/SpecimenS4.csv};
 \addplot+ [smooth,mark=none,name path=boundary4,] table [x=CH, y=L, col sep=comma] {ASTMe8Data/SpecimenS3.csv};
 \addplot+ [smooth,mark=none,name path=boundary5,] table [x=CH, y=L, col sep=comma] {ASTMe8Data/SpecimenS2.csv};
 \addplot+ [smooth,mark=none,name path=boundary6,] table [x=CH, y=L, col sep=comma] {ASTMe8Data/SpecimenS1.csv};

\addplot [color=gray!35] fill between [of=boundary1 and boundary2];
\addplot [color=gray!35] fill between [of=boundary1 and boundary3];
\addplot [color=gray!35] fill between [of=boundary1 and boundary4];
\addplot [color=gray!35] fill between [of=boundary1 and boundary5];
\addplot [color=gray!35] fill between [of=boundary1 and boundary6];
\addplot [color=gray!35] fill between [of=boundary2 and boundary3];
\addplot [color=gray!35] fill between [of=boundary2 and boundary4];
\addplot [color=gray!35] fill between [of=boundary2 and boundary5];
\addplot [color=gray!35] fill between [of=boundary2 and boundary6];
\addplot [color=gray!35] fill between [of=boundary3 and boundary4];
\addplot [color=gray!35] fill between [of=boundary3 and boundary5];
\addplot [color=gray!35] fill between [of=boundary3 and boundary6];
\addplot [color=gray!35] fill between [of=boundary4 and boundary5];
\addplot [color=gray!35] fill between [of=boundary4 and boundary6];
\addplot [color=gray!35] fill between [of=boundary5 and boundary6];

\end{axis}
\end{tikzpicture}

\end{document}

如 MWE 所示,我调出了六个 .csv 文件,并使用 CS 列作为横轴,L 列作为 Y 轴。这些数据来自拉伸钢强度试验。这些图表显示了横梁距离与施加在钢材上的力随时间的变化。

MiKTeX 内存不足,因为每个文件每列大约有 500 行数据。我正在尝试开发六条数据曲线的包络线。问题与我的 .csv excel 文件中的数据行太多有关。有没有办法告诉 pgfplots 只从 .csv 文件中选择一定范围的数据?比如说 excel 中的 30-200 行?我希望截断一些初始数据和最终数据,因为这些“书末”数据范围对图表没有多大作用。任何帮助都将不胜感激。

相关内容