I am trying to draw a coordinate system with tikz on top of a picture. I am trying to re-recreate the coordinate system in the attached figure as a test, but I have a few problems

  1. How do I change the offset of the coordinate system so it is right at the south-west corner of the figure?
  2. How do I change the spacing of the x- and y-axis so that they run from a min-value to a max-value with a step I decide?

My code is the following so far. This draws the coordinate system, but now I have to move it to the corner and change the spacing and max/min values:



\node[anchor=south west,inner sep=0] at (0,0) {\includegraphics[width=\textwidth]{test.jpg}};


enter image description here

  • 1
    You can check this question. – Kpym Oct 16 '16 at 11:05
  • Why don't you use pgfplots? – Enrico Oct 16 '16 at 14:01
  • @EnricoMariaDeAngelis I am very interested to see an example of how to do it with pgfplots – BillyJean Oct 20 '16 at 12:09
  • @BillyJean, I added my answer. Hope it's good. – Enrico Oct 20 '16 at 13:05

This should be more readable and working:



coordinates {
      (0,0,0) (7,0,0)

      (0,7,1) (7,7,1)

enter image description here

| improve this answer | |
  • Thanks, this is much more readable. Is is possible to shift the position of the coordinate system? Right now I am plotting the axes on top of a figure I load in externally using ` \node [inner sep=0pt] (c) {\includegraphics[scale=1]{urxul.jpg}};`, and I need to move the coordinate system to the corner of this picture – BillyJean Oct 20 '16 at 13:24
  • 1
    Maybe I don't understand what you mean by position of the coordinate system. If you're talking about the origin of the CS, then you can just set negative xmin and ymin in order to have the origin in the inner part of the axis. You could add a hand sketch of what you want to your question. – Enrico Oct 20 '16 at 13:43
  • Thanks, that worked. A final question, I hope this is alright: Is it possible to scale the x- and y-axis independently? So I can set their length manually. Right now I am using width=4cm, but this changes both axes – BillyJean Oct 20 '16 at 13:46
  • 1
    Check this – Enrico Oct 20 '16 at 13:49
  • Thanks, you really pushed me forward. I ended up using your solution, it is IMO much simpler to grasp – BillyJean Oct 20 '16 at 14:00

You can just draw over the image in the way the links you've been directed to illustrate. A few loops save typing, but that's all.

  \node [inner sep=0pt] (c) {\includegraphics[scale=3]{changeable}};
  \begin{scope}[shift=(c.south west), x=(c.south east), y=(c.north west)]
    \coordinate (x0) at (1,0);
    \path (0,0) \foreach \i in {1,...,8} { ++({1/8.1},0) node (x\i) [below, font=\scriptsize] {\i 0} edge [thin] +(0,2.5pt)};
    \path (0,1) coordinate (y0) \foreach \i in {1,...,8} { ++(0,-{1/8.1}) node (y\i) [left, font=\scriptsize] {\i 0} edge [thin] +(2.5pt,0)};
    \foreach \i in {1,...,8} \draw [thin] (y0 -| x\i) edge [gray!50, thin] +(0,-2.5pt) (x0 |- y\i) -- +(-2.5pt,0);

fake shading with looping tick marks

| improve this answer | |

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.