I have tried to import external 3D plots from Matlab et.al, but to no avail. To show what I managed to accomplish, I present a minimum non-working example below. Any ideas of what I'm doing wrong?
Cheers, Stefanos
Makefile:
all: 3dtest.pdf
3dtest.pdf: 3dtest.tex bumps.png
latexmk -pdflatex="xelatex -shell-escape " -pdf 3dtest.tex
bumps.png: bumps.m
matlab -nodesktop -nosplash -r "bumps;exit"
sleep 1
reset
convert bumps.png -trim +repage -transparent white bumps.png
bumps.m (don't bother running this with Octave, saving the surface plot is for some reason incredibly slow, and the result isn't very good):
function bumps()
figure(1)
[X,T]=meshgrid(linspace(0,1,400),linspace(0,2,400));
c=[3 2 5 4];
surf(X,T,abs(sin(c(1)*pi*X).*exp(1j*c(2)*pi*T)+sin(c(3)*pi*X).*exp(1j*c(4)*pi*T)))
shading interp
colormap(jet(1000))
axis off
setPapersize(6*[4 3])
print -dpng bumps
end
function setPapersize(papersize)
set (gcf,'papertype', '<custom>')
set (gcf, 'papersize', papersize)
set (gcf, 'paperposition', [0 0 papersize])
end
3dtest.tex:
\documentclass{standalone}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=10cm]
\addplot3 graphics[points={
(0,0,0) => (1212,0)
(1,0,0) => (2791,428)
(0,2,0) => (0,557)
(0.8872,2,1.854) => (1398,2064)
(1,2,2)
}] {bumps};
\end{axis}
\end{tikzpicture}
\end{document}
The resultant image:
EDIT: Original image:
FYI, I'm on Texlive 2012, using XeLaTeX (as seen in the Makefile).
\pgfplotsset{compat=1.6}
. No difference.