I'm trying to create a simple figure in which the tick labels will not line up properly, because the coordinate system is skewed. Here is the MWE code:
\documentclass[a4paper,twocolumn]{article}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning}
\begin{document}
\begin{figure}
\begin{center}
\begin{tikzpicture}
\node[anchor=south west, inner sep=0] (image) at (0.3,0.2) {\includegraphics[width=0.8\columnwidth]{asmmodes}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
\draw (-0.02, 0.833) node [right]{1};
\draw (-0.02, 0.5) node [right]{2};
\draw (-0.02, 0.167) node [right]{3};
\draw (0.07, -0.03) node [text centered,above]{-4};
\draw (0.22, -0.03) node [text centered,above]{-2};
\draw (0.37, -0.03) node [text centered,above]{-1};
\draw (0.50, -0.03) node [text centered,above]{0};
\draw (0.65, -0.03) node [text centered,above]{1};
\draw (0.79, -0.03) node [text centered,above]{2};
\draw (0.94, -0.03) node [text centered,above]{4};
\draw (0.5, -0.03) node [text centered,below]{standard deviations};
\draw (-0.04, 0.5) node [text centered]{\rotatebox{90}{first three model shape parameters}};
\draw [thick,red] (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
\end{scope}
\end{tikzpicture}
\end{center}
\label{fig:asmmodes1}
\end{figure}
\end{document}
This gives me the following output:
As you can see the tick labels are not lined up nicely because the coordinate system is skewed. I'm not sure what to do about this. Can someone help me out here?
Best Answer
First problem: when you change
x
andy
without changing the origin, your axis are not orthogonal. You have to shift the origin toimage.south west
.Second problem: the anchors of
image
are not on the borders of the included image becauseouter sep
is not null. You have to addouter sep=0
to remove this margin.Instead of
\rotatebox
, you may userotate
option.