Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

I was trying in vain to use a rotated ellipse today and finally got it to work in an extremely hackish way. Trying to follow up, I turned to the manual (pg. 26):

You can also append an ellipse to the path using the ellipse operation. Instead of a single radius you can specify two of them, one for the x-direction and one for the y-direction, separated by and:

\tikz \draw (0,0) ellipse (20pt and 10pt);

To draw an ellipse whose axes are not horizontal and vertical, but point in an arbitrary direction (a “turned ellipse” like) you can use transformations, which are explained later. The code for the little ellipse is \tikz \draw[rotate=30] (0,0) ellipse (6pt and 3pt);, by the way.

Now, perhaps I just didn't understand transformations well enough, but I assumed that:

\draw[rotate=angle] (x,y) ellipse (width,height);

would produce an ellipse centered at (x,y), rotated by angle and with the eccentricity values of width and height. Instead, I seem to be getting an ellipse rotates about the origin if (x,y) is anything other than (0,0).

Here was my test:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

\draw (0,0)--(10,0);
\foreach \x in {0,...,10}
  \draw (\x,0)--(\x,-.1) node[anchor=north] {\x};

\draw (0,0)--(0,10);
\foreach \y in {0,...,10}
  \draw (0,\y)--(-.1,\y) node[anchor=east] {\y};

\draw[help lines] (0,0) grid (10,10);

\draw (5,5) ellipse (10pt and 20pt);  
\draw[rotate=45] (5,5) ellipse (10pt and 20pt);

\end{tikzpicture}
\end{document}

This produces the first ellipse at (5,5) as expected. The second, though, shows up rotated but at approx. (0,7). What am I missing? Why is rotate rotating it "about" something rather than just putting it at the coordinates and rotating it in place?

image

share|improve this question

marked as duplicate by Jesse, mafp, OSjerick, Guido, ChrisS Jan 15 at 3:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 15 down vote accepted

You can use rotate around={degree:coordinate} to rotate the coordinate system by degree around the point coordinate:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw (0,0)--(10,0);
\foreach \x in {0,...,10}
  \draw (\x,0)--(\x,-.1) node[anchor=north] {\x};

\draw (0,0)--(0,10);
\foreach \y in {0,...,10}
  \draw (0,\y)--(-.1,\y) node[anchor=east] {\y};

\draw[help lines] (0,0) grid (10,10);

\draw (5,5) ellipse (10pt and 20pt);  
\draw[rotate=45] (5,5) ellipse (10pt and 20pt);
\draw[rotate around={45:(5,5)},red] (5,5) ellipse (10pt and 20pt);
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
I feel like an idiot. Having found rotate around in the manual... it's exactly what I needed. Rotate around sounded intuitively like what was happening, whereas rotate sounded like it should just rotate in place. Thanks. –  Hendy Mar 14 '12 at 2:00

To complete the answer : before the option : rotate around it was possible to use this (it's possible to make shorter ...)

\documentclass[11pt]{scrartcl}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
 \draw (0,0)--(10,0);
\foreach \x in {0,...,10}
  \draw (\x,0)--(\x,-.1) node[anchor=north] {\x};

\draw (0,0)--(0,10);
\foreach \y in {0,...,10}
  \draw (0,\y)--(-.1,\y) node[anchor=east] {\y};

\draw[help lines] (0,0) grid (10,10);
\draw[red] (5,5) ellipse (4 and 2);   

\begin{scope}[shift={(5,5)}] 
    \begin{scope}[rotate=90]
        \begin{scope}[shift={(-5,-5)}]
            \draw (5,5) ellipse (4 and 2); 
        \end{scope} 
    \end{scope} 
\end{scope}

\end{tikzpicture}
\end{document} 

enter image description here

share|improve this answer

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