3

I'm currently working with tikz and pgfplots to set a few plots. It works marvelously for a lot of applications, add I have set a number of plots (especially surfaces from matlab) with help of the scripts from 3-dimensional histogram in pgfplots.

However, the current plot is over my head. The final result is offset to the axis somehow, but the mapping seems to do fine. I have scoured over several posts like Why do I fail to import external 3D plots with pgfplots?, Problem with external graphics and 3D pgfplots and a few others with no avail.

I added 4 corner points at the limits of the axis to be able to produce the necessary 4 points. those are the black crosses visible in the image.

Below is a MWE:

\documentclass[a4paper,10pt]{scrartcl}

\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
% defining custom colors
\begin{tikzpicture}

\begin{axis}[%
view={-173}{18},
scale only axis,
clip = false,
xmin=-26.9710631775209,
xmax=-13.4358218716748,
ymin=0.106301614157972,
ymax=14.7011505583562,
z dir=reverse,
zmin=450.566465947184,
zmax=457.647656398296,
axis x line*=bottom,
axis y line*=left,
axis z line*=left
]
\addplot3 graphics[debug = visual,
points={% important
(-26.9711,0.1063,450.5665) => (337.0523,431.7509)
(-13.4358,14.7012,457.6477) => (138.9328,163.2305)
(-26.9711,14.7012,457.6477) => (391.2548,186.9052)
(-13.4358,0.1063,457.6477) => (86.5994,289.703)
}] {img};
\end{axis}
\end{tikzpicture}%
\end{document}

MWEimg

  • Welcome at tex.sx! Unfortunately, the web platform has rescaled your graphics such that the browser's "save graphics as" does not longer fit to your coordinates. Could you provide the graphics somewhere else? Dropbox or something like that? – Christian Feuersänger Jun 21 '13 at 20:00
  • 1
    Actually, I just managed to solve the problem. For some reason, my matlab figure window was in "Docked" mode. THis screws with the get(gcf,'Position') as it then always returns [1 1 w h], which then of course again screws with the pt calculation. Using set(gcf,'WindowStyle','normal') fixes that again! – JoeD Jun 22 '13 at 10:07
  • If you still want the image, I'll upload it somewhere – JoeD Jun 22 '13 at 10:08
  • Unrelated to the question: What is that surface? A DEM of a valley? – Jake Jun 22 '13 at 11:54
2

For some reason, my matlab figure window was in "Docked" mode. This screws with the

get(gcf,'Position') 

as it then always returns [1 1 w h], which then of course again screws with the pt calculation. Using

set(gcf,'WindowStyle','normal') 

fixes that again!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.