pgfplots: Plotting one data set with label and the other without label
I am trying to generate a plot using two data series and have the labels just on one of the series, but not the other. In the following example I would like to see the labels on first \addplot, but not the second.
\begin{figure}[htb]
\centering
\begin{tikzpicture}
\begin{axis}
[xlabel={$\beta_G$},ylabel={E$_{Peak}$/E$_{acc}$},
xmin=0.45, xmax=1.05,
ymin=1.5, ymax=5.5,
nodes near coords,
every node near coord/.append style={anchor=west},
point meta=explicit symbolic]
\addplot [red, only marks] table[x index=0,y index=1, meta index = 2] {Data.txt};
\addplot [blue] table[x index=0,y index=3] {Data.txt} ;
\end{axis}
\end{tikzpicture}
\caption{Two data series.}
\label{fig:two}
\end{figure}
The file Data.txt looks like:
#X_value Y_value Label Fit
1 0.6 One 0.5
1.1 0.65 two 0.6
1.2 0.7 three 0.75
I am trying to generate a plot using two data series and have the labels just on one of the series, but not the other. In the following example I would like to see the labels on first \addplot, but not the second.
\begin{figure}[htb]
\centering
\begin{tikzpicture}
\begin{axis}
[xlabel={$\beta_G$},ylabel={E$_{Peak}$/E$_{acc}$},
xmin=0.45, xmax=1.05,
ymin=1.5, ymax=5.5,
nodes near coords,
every node near coord/.append style={anchor=west},
point meta=explicit symbolic]
\addplot [red, only marks] table[x index=0,y index=1, meta index = 2] {Data.txt};
\addplot [blue] table[x index=0,y index=3] {Data.txt} ;
\end{axis}
\end{tikzpicture}
\caption{Two data series.}
\label{fig:two}
\end{figure}
The file Data.txt looks like:
#X_value Y_value Label Fit
1 0.6 One 0.5
1.1 0.65 two 0.6
1.2 0.7 three 0.75
No comments:
Post a Comment