pgfplots:列中的图例

pgfplots:列中的图例

在下面的例子中,如何使用列label作为图例的源?

\documentclass{article}
\usepackage[a4paper, left =2cm, top = 2cm, right = 2cm, bottom = 2cm]{geometry}
\usepackage[table,xcdraw]{xcolor}
\usepackage[document]{ragged2e}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
      \begin{axis}[
          width=4.5in,
          height=3.5in,
          scale only axis,
          xtick distance=1,
          ytick distance=1,
          %ymin=89,
          %ymax=98,
          xlabel=X,
          ylabel=Y
       ]
      \addplot[
          point meta=explicit symbolic,
          nodes near coords,
          scatter=true,
          only marks,
          mark=*,
          scatter/classes={
              A={mark=*,blue},
              B={mark=*,red}
          }
      ] table [x={x},y={y},meta=label] {
x    y     abc  label             
1.25 96.88 54.4 A
0.58 96.25 21.8 B
};
      \end{axis}
      \end{tikzpicture}
\end{document}

相关内容