# Problem with external graphics and 3D pgfplots

I want to include an external graphics with pgfplots. I tried to follow the instructions of the manual (p45 et seq.) as carefully as possible. But the result is hoorible as hell.

Here is the code I am using:

\documentclass[12pt,twoside,a4paper]{report}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.6}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis on top=true,
grid=both,minor tick num=1,
xlabel=$x$,ylabel=$y$,zlabel=$z$]
points={%difference of canvas y coord. because pgfplots counts from the lower left.
(353,754.7,196) => (2,1192-944)
(356,757,198) => (476,1192-153)
(353,758.5,198) => (188,1192-1)
(356,753.3,196) => (242,1192-1192)
}] {Example.png};
\end{axis}
\end{tikzpicture}
\end{document}


And here is the graphics I try to include:

Here is the same graphics in which I marked in orange the 3D-coordinates and below in black the canvas coordinates (which I read out via paint).

And here is the same graphics in a box (made with Mathematica) to show that I read out the coordinates correctly and to give an impression of the dimensions and the orientation:

And here is the screenshot of the odd result:

I guess I am doing something wrong. But I cannot find my mistake. Can somebody of you give me a hint?

-
I am guessing it has something to do with different axes scaling differently. – mythealias Oct 23 '12 at 23:32
Thanks for the feedback. I tried to change with e.g. z post scale=2 etc. the axis scaling, but nothing works. The funny thing is: If I make a 3D plot just of my points, I get almost what I want. But I still cannot manage it for my desired plot. Do you or others can give a bit more help? – partial81 Oct 24 '12 at 6:42
I can reproduce the problem, but I do not know what happens. I recomputed the canvas coords with gimp (they have been completely different, but the result looks the same). I added the debug key to \addplot graphics[ debug and inspected the file: the matrix looks ok. I solved the system with octave (it has full rank) and it also results in the wrong output. The result receives a skewed z vector! It seems like a rotated hyperplane, is that right? I am wondering if that can make a difference... did you try to use some other coordinate which is not on the hyperplane (like your red dot)? – Christian Feuersänger Oct 24 '12 at 10:28
Thanks @Christian: I guess you get other coordinates because the size changed a bit after uploading. Yes, the figure is a part of a cone. I plotted one more graphics so that one can see that I read out the coordinates correctly (I multiply x,y by 10^9,z by 10^6). If I follow you advice and use the red dot, I get a good result! One can check this by using my first pic of my post and the coordinates (353,754.7,196)=>(46,517-393),(356,757,198)=>(254,517-94),(353,758.5,198)=>(121,‌​517-0),(354.5,753.3,198)=> (73,517-95) instead of the original (356,753.3,196)=>(156,517-515). Well, it works! But why? – partial81 Oct 24 '12 at 17:43
@partial81 I think it could be a projection issue. By the way, your projection is perspective (not parallel) and pgfplots supports only the second, at the moment. – Luigi Oct 24 '12 at 18:03