## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Drawing a circle with tikz Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Suomenlinna
Posts: 3
Joined: Fri Apr 03, 2015 3:26 pm

### Drawing a circle with tikz

Hi everyone,
I'm trying to draw a circle with tikz.
I've tried to adapt this example: http://www.texample.net/tikz/examples/cycle/
My circle should satisfy the following properties:
(1) There should be, for a fixed $n$, $n$ invisible vertices (with equal distance) on the circle line. Moreover, these vertices should be numbered from $1$ up to $n$ (but the numbers should not be on the circle line, but a little outside.
(2) Some pairs of vertices should be connected. These connecting edges should be within the circle.

So far I have got this far:
\documentclass[12pt,a4paper]{scrartcl}\usepackage{tikz}\begin{document}\begin{tikzpicture} \def \n {5}\def \radius {1cm} \foreach \s in {1,...,\n}{   \node at ({360/\n * (\s - 1)}:\radius) {$\s$} ;   \draw[-, >=latex] ({360/\n * (\s - 1)}:\radius)      arc ({360/\n * (\s - 1)}:{360/\n * (\s)}:\radius);} \foreach \from/\to in {1/2,3/5}\draw ({360/\n * (\from - 1)}:\radius) -- ({360/\n * (\to - 1)}:\radius);  \end{tikzpicture}\end{document}

Now, I have two problems:
(1) The numbers 1,...,5 are on the circle line, not outside. This looks not good in my opinion. Is there a way to change that?
(2) If I increase $n$ to, say, 15, and two consecutive numbers (like 1 and 2 in my example) are connected, then you can't see the connecting vertex that well. Therefore, I would like to connect consecutive vertices not with a straight line, but with a "more round line" that goes a little bit into the circle. I hope it's understandable what I mean by that.

Tags:

Stefan Kottwitz
Posts: 9416
Joined: Mon Mar 10, 2008 9:44 pm
Welcome to the forum!

1. You could simply apply a factor to the radius:
\node at ({360/\n * (\s - 1)}:1.25\radius) {$\s$} ;

2. circle-1.png (10.41 KiB) Viewed 4024 times

3. You could change the straight line -- to to [bend left=60] to get a rounded line:

\draw ({360/\n * (\from - 1)}:\radius) to [bend left=60] ({360/\n * (\to - 1)}:\radius);

circle-2.png (14.59 KiB) Viewed 4024 times

Adjust the number to get a smaller or larger angle.

Stefan

Suomenlinna
Posts: 3
Joined: Fri Apr 03, 2015 3:26 pm
Thank you very much, it does work just like I expected!

Thank you!

Suomenlinna
Posts: 3
Joined: Fri Apr 03, 2015 3:26 pm
Okay, I seem to have another question/problem:

I want to connect two nodes, say 1 and 2 with an arc - but so that the center of the cirle is contained in this sector of the circle.

So, is there a way to draw an (invisible) node at, say, P=({360/\n * (4 - 1)}:0.3\radius) and draw a (smooth) arc through 1, P and 2?

I hope you can understand my question.

Best regards,
Suomenlinna

Stefan Kottwitz
Posts: 9416
Joined: Mon Mar 10, 2008 9:44 pm
Hi Suomenlinna,

Suomenlinna wrote:Okay, I seem to have another question/problem

we don't sort questions per user, but per topic. You see, this topic is "Drawing a circle with tikz", matching the original question fine, but who shall now expect something about drawing an arc through some points? Or how many readers may see it at all, at the bottom of a solved topic? I can split it later on, so don't miss the new topic, you may look at "View your posts" at the right menu, or your profile, to find it. For now, this message, let's see if some helper finds the way here or then to the fresh one (possibly I as well).

Feel free to open a new topic for each new question. We got space for millions of topics. And it's easier to sort and to find (than on page 6 of an old topic )

Stefan