6

I would like to stack several external 2d plots into a 3d axis environment like the orange and green planes in my example. As the 2d plots are created externally, I am looking for a way to rotate and insert these external graphics accordingly. The \addplot graphics command will not provide the desired result as it does not seem to understand 3d, and also addplot3 graphics does not work the way I hoped (uncommenting this part will result in an error).
So, is there a way to insert 2d external graphics in a 3d plot and make them appear in the desired perspective?

\documentclass[crop,10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[view={70}{30},
    xmin=-1.5,xmax=1.5,ymin=-1.5,ymax=1.5,zmin=-1.5,zmax=1.5,
    xlabel=x,
    ylabel=y,
    zlabel=z,
    ]
\filldraw[orange] (axis cs:-1,-1.5,-1.5) -- (axis cs:-1,-1.5,1.5) -- (axis cs:-1,1.5,1.5) -- (axis cs:-1,1.5,-1.5)  -- cycle;
\filldraw[green] (axis cs:0,-1.5,-1.5) -- (axis cs:0,-1.5,1.5) -- (axis cs:0,1.5,1.5) -- (axis cs:0,1.5,-1.5)  -- cycle;
\addplot graphics [xmin=0,xmax=0,ymin=-1.5,ymax=1.5,zmin=-1.5,zmax=1.5] {anygraphics};
%\addplot3 graphics[
%       points={
%           (-1,-1.5,1.5) => (0pt,566pt)
%           (-1,1.5,1.5) => (566pt,566pt)
%           (-1,1.5,-1.5) => (566pt,0pt)
%           (-1,-1.5,-1.5) => (0pt,0pt)
%           }
%       ]
%       {anygraphics};
    \end{axis}
\end{tikzpicture}

\end{document}
Janek
  • 1,303
  • 1
  • 13
  • 33

1 Answers1

5

Currently, Pgfplots cannot project 2d content on arbitrary surfaces in 3d space.

That would be a feature request for pgfplots.

If you have an image of some orthogonal 3d projection (say, anygraphics.png) and want to overlay a 3d axis on top of that 2d image, you can use \addplot3 graphics. If that is part of what you want, you may need to elaborate on the phrase "does not work the way I hoped" and provide a reproducable minimal working example.

  • In my case, I really want to stack several 2D plots behind each other and not put an axis on a projected 3d plot. I hoped to clarify this by adding the two planes to the picture to demonstrate the desired behaviour. So I'll accept your first sentence as an answer and submit a feature request. – Janek Sep 16 '13 at 13:06