In this MWE, the table data loaded from poles.dat
is successfully parsed as shown in the left plot.
However, storing the same data inside a macro using \pgfplotstableread
doesn't result in the same expected output.
Why is there a difference between both ways? and how to make the second approach of pgfplotstableread
work like the first one of *.dat
file?
\documentclass[border=1cm]{standalone}
\usepackage{pgfplots,pgfplotstable}
\pgfplotsset{compat=newest,
poles/.style= { only marks, mark=x, mark size = 1ex, thick},
point meta = explicit symbolic,
visualization depends on={\thisrow{angle} \as \myangle},
visualization depends on={value \thisrow{label} \as \mylabel},
Label Style/.style args = {#1}{
nodes near coords,
every node near coord/.style = %
{
anchor=south, label={[#1]\myangle:{\mylabel}}
},
}
}
\usepackage{filecontents}
\begin{filecontents*}{poles.dat}
Re Im label angle
-2 2 (-2,2) 270
-2 -2 (-2,-2) 90
-4 0 (-4,0) 60
\end{filecontents*}
\pgfplotstableread{
Re Im label angle
-2 2 (-2,2) 270
-2 -2 (-2,-2) 90
-4 0 (-4,0) 60
}\mytable
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot[Label Style={blue,fill = gray!20},poles] table {poles.dat};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}
\addplot[Label Style={blue,fill = gray!20},poles] table {\mytable};
\end{axis}
\end{tikzpicture}
\end{document}
*.dat
file? – Diaa Nov 22 '18 at 19:52