7

I am trying to make use of explicit meta data that I add to coordinates in a scatter plots. However, I do not want the transformed data, rather it should be the original one. This question is motivated by this question, where the raw meta data was to be used to set the node anchors.

Problem: Why is there an additional ] in the end. That is, why is 0 getting mapped to 0Y0.0e0] rather than 0Y0.0e0? AFAIK thisextra ] should not be there, or am I missing something? This thingy makes it very hard to parse the data to get back the original entry.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16,
poles/.style= { scatter,
        scatter src=explicit, only marks, mark=x, mark size = 1ex, thick},
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[% point meta=explicit symbolic, %<- does not help (as expected)
visualization depends on=\pgfplotspointmeta \as \mymeta,
    nodes near coords={\pgfplotspointmeta}, % \pgfplotspointmetatransformed transforms the values
    enlargelimits=0.3]
\addplot[poles] coordinates {(-2,2)[90] (-2,-2)[270] (-8,0)[0]};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

I understand that if one was to provide the data in form of a table, the analogous problem would be absent. That is to say that I am not interested in a workaround in which the data is being read from a table.

1 Answers1

6

You were already on the right track: point meta=explicit symbolic is what you need.

However, the polar style overrides this setting by means of scatter src=explicit. The key scatter src is a legacy alias for point meta (it was present before the concept of point meta data was defined in its general form).

The result is thus

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16,
poles/.style= { scatter,
        only marks, mark=x, mark size = 1ex, thick},
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[point meta=explicit symbolic,
    nodes near coords={\pgfplotspointmeta},
    enlargelimits=0.3]
\addplot[poles] coordinates {(-2,2)[90] (-2,-2)[270] (-8,0)[0]};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

  • 1
    Sorry, I have simply not seen this answer. If I had seen it, I would have accepted back then. Sorry! –  Jan 27 '19 at 00:59