The fact is that I am using \pgfextractx and \pgfextracty to get the x,y values from a coordinate. They return 0 to me regardless of the content of my coordinate. That is, this
\coordinate (E) at (0.308017, -0.951057);
\newdimen\ex
\pgfextractx{\ex}{(E)}
returns me 0 while we know it should return 0.308017.
However when I use \pgfpoint it works.
That is
\newdimen\cx
\pgfextractx{\cx}{\pgfpoint{1}{2}}
returns me a "1" which is fine. I want to do this with coordinates no with
pgfpoints. Can I convert one into the other?
Otherwise how can extract a coordinate without having to use pgfpoint, or path or addplot or other weird things? What would be the best solution?
**This is not an answer but my comment (actually question) will not fit in a comment slot.
When I use the code:
\begin{document}
\begin{tikzpicture}
\coordinate (E) at (0.308017pt, -0.951057pt);
\newdimen\ex
\pgfextractx{\ex}{\pgfpointanchor{E}{center}}
\newdimen\ey
\pgfextracty{\ey}{\pgfpointanchor{E}{center}}
\coordinate (H) at (\ex, \ey);
\node[] at (H) {This is E };
\pgfmathprintnumber{1.2};
\end{tikzpicture}
\end{document}
Yes, the 1.2 is located in a bad place but it is telling me that "pgfmathprintnumber" is working. However when I change the line
\pgfmathprintnumber{1.2};
for the line
\pgfmathprintnumber{\ex};
The code does not compile. Here is the error:
Package pgfplots Warning: running in backwards compatibility mode (unsuitable ti ck labels; missing features). Consider writing \pgfplotsset{compat=1.12} into yo ur preamble. on input line 10.
! Missing \endcsname inserted.
\ex l.20 \pgfmathprintnumber{\ex} ;
do not worry about the "backwards compatibility" I already tried adding the line suggested above and nothing changes. Why the error? it is like if it did not understand the variable "\ex" so that this method did not work.
I am following @Ulrike advise but without the line "\showthe\ex" since that line was giving me another compilation error.
Now, if instead I use the line:
\node[] at (H) {\pgfmathprintnumber{\ex}};
The code does gives me this error:
! Missing \endcsname inserted.
\ex l.19 \node[] at (H) {\pgfmathprintnumber{\ex} };
Which says something like "ex" is a NaN (not a number) object?
Thanks.
Now, here is a compilation error that happens when I used "\the\ex" as suggested by @Tornbjorn .
been generated with the most recent feature set (\pgfplotsset{compat=1.12}).
! Package PGF Math Error: Could not parse input '8.76384pt' as a floating point number, sorry. The unreadable part was near 'pt'..
See the PGF Math package documentation for explanation. Type H for immediate help. ...
l.19 ...) {This is E \pgfmathprintnumber{\the\ex} }; ?
Thanks.
I solved my problem without having to convert from coordinate to pgfpoint and viceversa.
My issue was mostly because trying to extract the coordinates.
I learned from the following link: Accessing the logic values of a TikZ coordinate
and mainly from the macro:
\makeatletter
\def\extractcoord#1#2#3{
\path let \p1=(#3) in \pgfextra{
\pgfmathsetmacro#1{\x{1}/\pgf@xx}
\pgfmathsetmacro#2{\y{1}/\pgf@yy}
\xdef#1{#1} \xdef#2{#2}
};
}
which works quite good in my case. Thanks all for your help.


pgfplots, so I removed that tag. – Torbjørn T. Oct 18 '15 at 20:21{}above the text field). Blocks will be indented with four spaces, inline code placed between backticks (```). – Torbjørn T. Oct 18 '15 at 21:00edited before ...you can see, who edit your question what he/she change. In your case all credits go to TorbjørnT. – Zarko Oct 18 '15 at 21:05