从文件和标签点读取数据

从文件和标签点读取数据

我正在从数据文件中读取点。我想知道如何分别标记点 x1、x2、....、x7?

这是我的代码:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{groupplots}

\newcommand{\datapthreeone}{checkp31.dat}
\begin{filecontents*}{\datapthreeone}
    x1     y1  averX  averY     Ex     Ey
 2.000,  3.000, -0.714,  1.286, -1.116,  0.958
 1.000,  2.000, -1.714,  0.286,  0.065,  1.737
 1.000,  1.000, -1.714, -0.714,  1.044,  1.536
 2.000,  2.000, -0.714,  0.286, -0.136,  0.757
 4.000,  2.000,  1.286,  0.286, -0.538, -1.202
 4.000,  1.000,  1.286, -0.714,  0.441, -1.403
 5.000,  1.000,  2.286, -0.714,  0.240, -2.383
\end{filecontents*}

% {x1,x2,x3,x4,x5,x6,x7}={(2,3),(1,2),(1,1),(2,2),(4,2),(4,3),(5,1)}

\begin{document}
\begin{figure}
\begin{center}
\begin{tikzpicture}
\begin{groupplot}[group style={group size=2 by 2, horizontal sep=4em, vertical sep=5em}]
\nextgroupplot[xmin=0, xmax=6, ymin=0, ymax=4, legend style={font=\fontsize{7}{9}\selectfont}, title = (a) Data set with mean]
\addplot [only marks, line width = 0.3mm, mark=triangle*, red, mark options={scale=1.2},nodes near coords={\labelz},visualization depends on={value \thisrowno{1}\as\labelz}] table[x index=0, y index=1, only marks,col sep=comma] {\datapthreeone}; \addlegendentry{$Data$}

\end{groupplot}

\end{tikzpicture}
\end{center}
\end{figure}

\end{document}

相关内容