LaTeX forum ⇒ Graphics, Figures & Tablestikzpicture coordinates Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Posts: 36
Joined: Sun Jun 10, 2012 12:33 pm

tikzpicture coordinates

Postby asafw » Fri Oct 13, 2017 8:35 pm


I'm trying to use tikzpicture to draw a circle as follows, but when I change coordinates -- say, from (0,0) to (10,0) -- this has no effect on positioning. Any idea why? (or should I submit a full MWE?)

Thanks so much,

  1. \begin{frame}
  2. \begin{tikzpicture}
  3. \draw (0,0) ellipse (2cm and .5cm);
  4. \end{tikzpicture}
  5. \end{frame}

User avatar
Stefan Kottwitz
Site Admin
Posts: 8704
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany

Postby Stefan Kottwitz » Fri Oct 13, 2017 10:35 pm

Hi Asaf!

Yes, a full MWE is always good. You know, we cannot test without an MWE, and every time somebody posts a code snippet we have to build an MWE ourselves. That's because we always want to post properly tested solutions, verified that they work.

The coordinates have effect on the positioning within the TikZ picture. But the picture contains only the ellipse, it is automatically cut, the bounding box is just big enough to contain what you have drawn. So, one time it contains the coordinate (0,0), at the other time when you just change the coordinates it starts at (0,10) where your actual drawing content starts. So it looks the same on your beamer slide, just with different coordinates within.

A quick fix is: add an empty node at (0,0). So the drawing contains the node (0,0) and your ellipse at (0,10), then you see the positioning changes.

  1. \documentclass{beamer}
  2. \usepackage{tikz}
  3. \begin{document}
  4. \begin{frame}
  5. \begin{tikzpicture}
  6. \node at (0,0) {};
  7. \draw (0,10) ellipse (2cm and .5cm);
  8. \end{tikzpicture}
  9. \end{frame}
  10. \end{document}

Full MWE. :-) So a reader can test, for example by just on click on "Open in Overleaf" at the top of the code. That's why I use a code box for LaTeX code: syntax highlighting, readability, one-click online compiling. That's done with the Code button when editing (mark text, click Code).

Site admin

Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 15 guests