Graphics, Figures & TablesTwo Circles in Tikz

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Two Circles in Tikz

Post by coachbennett1981 »

I am new to tikz and I am having a tough time figuring out what needs to be down. I would like to have two circles, centering at O and P respectively, and both circles intersecting at Point B. Here is my code.. Does anyone know how ot fix my mistake?

Thank you..

Code: Select all

\documentclass[12pt]{exam}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc,through,backgrounds}
\begin{document}

\section*{Figure 1.3}
\begin{tikzpicture}[scale=2]
\coordinate [label=left:$O$] (O) at (0,0);
\coordinate [label=left:$A$] (A) at (-1,0);
\coordinate [label=left:$B$] (B) at (1,0);
\coordinate [label=right:$C$] (C) at (3,0);
\coordinate [label=above:$P$] (P) at (2,0);
\node[draw,circle through=(A)--(B)]{};
\node[draw,circle through=(B)--(C)]{};
\filldraw[black](A) circle (1pt);
\filldraw[black](B) circle (1pt);
\filldraw[black](O) circle (1pt);
\filldraw[black](P) circle (1pt);
\filldraw[black](C) circle (1pt);
\end{tikzpicture}

\end{document}

Nick
Last edited by coachbennett1981 on Sun Jun 27, 2010 2:30 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

Two Circles in Tikz

Post by torbjorn t. »

Code: Select all

\documentclass[12pt]{exam}
\usepackage{tikz}
\usetikzlibrary{through}

\begin{document}
\section*{Figure 1.3}

\begin{tikzpicture}[scale=2]
  \coordinate [label=left:$O$] (O) at (0,0);
  \coordinate [label=left:$A$] (A) at (-1,0);
  \coordinate [label=left:$B$] (B) at (1,0);
  \coordinate [label=right:$C$] (C) at (3,0);
  \coordinate [label=above:$P$] (P) at (2,0);
  \node[draw,circle through=(B)] at (O) {};
  \node[draw,circle through=(B)] at (P) {};
  \filldraw[black](A) circle (1pt);
  \filldraw[black](B) circle (1pt);
  \filldraw[black](O) circle (1pt);
  \filldraw[black](P) circle (1pt);
  \filldraw[black](C) circle (1pt);
\end{tikzpicture}

\end{document}
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Two Circles in Tikz

Post by coachbennett1981 »

Thank you so much. Is there a way to make Circle P larger that Circle O? I have been working on this at also can not figure this out. I have tried changing the coordinates on of C to be further along the x axis, but alas, it is wrong. I have to much overlap. I need the circle to still go through B..

Any suggestions? I would appreciate it..


Code: Select all

\section*{Figure 1.3}
\begin{tikzpicture}[scale=2]
  \coordinate [label=left:$O$] (O) at (0,0);
  \coordinate [label=left:$A$] (A) at (-1,0);
  \coordinate [label=left:$B$] (B) at (1,0);
  \coordinate [label=right:$C$] (C) at (3.5,0);
  \coordinate [label=above:$P$] (P) at (2,0);
  \node[draw,circle through=(B)] at (O) {};
  \node[draw,circle through=(B),scale=1.5] at (P) {};
  \filldraw[black](A) circle (1pt);
  \filldraw[black](B) circle (1pt);
  \filldraw[black](O) circle (1pt);
  \filldraw[black](P) circle (1pt);
  \filldraw[black](C) circle (1pt);
\end{tikzpicture}



Nick
torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

Two Circles in Tikz

Post by torbjorn t. »

The points A and C are irrelevant as far as the circles are concerned. The circle is defined by its center point (that is, O or P), and the point it intersects (that is, B). I should perhaps have mentioned this above, sorry about that.

To make the circle around P larger than the one around O, simply move point P further away from B:

Code: Select all

\documentclass[12pt]{exam}
\usepackage{tikz}
\usetikzlibrary{through}

\begin{document}

\begin{tikzpicture}[scale=2]
  \coordinate [label=left:$O$] (O) at (0,0);
  \coordinate [label=left:$B$] (B) at (1,0);
  \coordinate [label=above:$P$] (P) at (3,0);
  \node[draw,circle through=(B)] at (O) {};
  \node[draw,circle through=(B)] at (P) {};
  \filldraw[black](B) circle (1pt);
  \filldraw[black](O) circle (1pt);
  \filldraw[black](P) circle (1pt);
\end{tikzpicture}

\end{document}
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Re: Two Circles in Tikz

Post by coachbennett1981 »

I just came back on to say I figured it out as well.. That is, by moving point P.. Thank you for you quick responses. Feels good to actually solve a problem the same way someone else did.. I know I am on the right track.

Best,

Nick
Post Reply