5

In relation to this quesion:

How can one place nodes along a rotated ellipse? ()

  • 2
    Welcome to TeX.SX. What do you mean by rotated ellipse? Kindly add the code you have tried so far. – user11232 Aug 7 '13 at 8:28
  • An ellipse where the major axis is not in parallel to the x- or the y-axis. For code and graphical illustration in the unrotated case please take a loot at the linked question. – Garlef Wegart Aug 7 '13 at 9:09
10

It is not clear to me how your code will look like that draws a rotated ellipse. The code in the linked answer can be simply rotated as a whole by \begin{tikzpicture}[rotate=60]:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}[rotate=60]
    \draw (2,0) ellipse (2 and 1);
    \node[draw,fill=blue,circle,text=white] at ($(2,0)+(75:2 and 1)$) {A};
    \node[draw,fill=red,circle,text=white] at ($(2,0)+(275:2 and 1)$) {B};
\end{tikzpicture}
\end{document} 

enter image description here

If you want the node contents to be rotated too, then use transform shape like \begin{tikzpicture}[rotate=60,transform shape] in the above code.

enter image description here

To address the query in the comments:

To hide the ellipse itself you may

  1. comment out the entire line

    \draw (2,0) ellipse (2 and 1);
    
  2. use draw=none as the option

    \path[draw=none] (2,0) ellipse (2 and 1);
    

Some sample code for fun:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
%
\begin{document}
\begin{tikzpicture}[rotate=60]
\foreach \x/\y in {0/A,30/B,60/C,90/D,120/E,150/F,180/G,210/H,240/I,270/J,300/K,330/L}{
    \node[draw=none,minimum width=10pt,fill=blue!60!green!30,circle,text=white,inner sep=0pt,outer sep=0pt] at ($(2,0)+(\x:2 and 1)$) {\y};
    }
\end{tikzpicture}
\end{document}

enter image description here

|improve this answer|||||
  • Thanks a lot; This will do the trick. How can i prevent the drawing of the ellipse? I don't want it to be visible; I just need the nodes to be at the corresponding coordinates. – Garlef Wegart Aug 7 '13 at 13:20
  • 1
    @GarlefWegart Please see the edit. – user11232 Aug 7 '13 at 13:57
  • Great answer; Thank you. Misfortunately I can't give you more then one +1 :) – Garlef Wegart Aug 7 '13 at 14:00
  • @GarlefWegart: Glad it helped :) – user11232 Aug 7 '13 at 14:02
3

You can also use an arc to draw the ellipse, which allows you to place the nodes a specified distance along the border of the ellipse:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw [rotate=30, x radius=2cm, y radius=1cm, delta angle=360] (0,0)
    arc [start angle=0]
    node [pos=0.13] {A}
    node [pos=0.75] {B};
\end{tikzpicture}
\end{document}  
|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.