I would like to draw a frame like the following around a picture without changing the ratio of the picture.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[gray,thin]
\draw (-6,0) rectangle (6,7);
%bottom marks
\foreach \x in {-6,-5.6,..., 6}
\draw (\x,0) -- (\x, .1) ;
\foreach \x/\num in {-4/-1.0,-2/-0.5,0/0.0,2/0.5,4/1.0}
\draw (\x,0) node[below]{$\num$}-- (\x,.2);
%top marks
\foreach \x in {-6,-5.6,..., 6}
\draw (\x,7) -- (\x, 6.9) ;
\foreach \x in {-4,-2,...,4}
\draw (\x,7)-- (\x,6.8);
%left marks
\foreach \y in {0,0.35,...,7}
\draw (-6,\y) -- (-5.9,\y);
\foreach \y/\num in {1.4/-0.5,2.8/0.0,4.2/0.5,5.6/1.0}
{
\draw (-6,\y) node[left]{$\num$} -- (-5.8,\y);
}
%right marks
\foreach \y in {0,0.35,...,7}
\draw (6,\y) -- (5.9,\y);
\foreach \y in {1.4,2.8,...,5.7}
{
\draw (6,\y) -- (5.8,\y);
}
\end{tikzpicture}
\end{figure}
\end{document}
My main problem is that I don't know how to make the frame match my picture without deforming the latter. I started by putting a rectangle around the picture but I couldn't figure out how to put the tick-marks in a convenient way. I guess, I would need the coordinates of the south-west and north-east corner for that. Is there a way to get them?
(current bounding box.north east)
and(current bounding box.south west)
?pgfplots
?\node[inner sep=0pt](Img){\includegraphics{example-image}};
, you can get the coordinate of the lower left corner with(Img.south west)
and the upper right with(Img.north east)
.