Graphics, Figures & TablesShading a circle

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

Shading a circle

Post by coachbennett1981 »

I can shade the triangle, but not the quarter of the circle BAC. Can anyone help? I am new to tikz..

Thank you

Code: Select all

\documentclass[12pt]{exam}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc,through,backgrounds}
\begin{document}
\section*{Figure 1.2}
\begin{tikzpicture}[scale=2]
\coordinate [label=left:$B$] (B) at (0,0);
\coordinate [label=right: $C$] (C) at (2,0);
\coordinate [label=below:$A$] (A) at (0,-2);
\filldraw [black] (0,0) circle (1pt);
\filldraw [black] (2,0) circle (1pt);
\filldraw [black] (0,-2) circle (1pt);
\node [draw, circle through=(C)--(B)] at (B) {};
\draw (B) -- (C);
\draw (B) -- (A);
\fill[red] (B)--(A)--(C)--cycle;
\end{tikzpicture}

\end{document}


Last edited by coachbennett1981 on Sat Jun 26, 2010 8:29 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.

shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Shading a circle

Post by shadgrind »

If you mean the segment created by BAC, you could do it like this:

Code: Select all

\documentclass[12pt]{exam}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc,through,backgrounds}
\begin{document}
\section*{Figure 1.2}
\begin{tikzpicture}[scale=2]
\coordinate [label=left:$B$] (B) at (0,0);
\coordinate [label=right: $C$] (C) at (2,0);
\coordinate [label=below:$A$] (A) at (0,-2);
\filldraw[black,fill=red] (B)--(A)--(C)--cycle;
\fill[green] (A) arc (270:360:2) -- cycle; 
\filldraw [black] (A) circle (1pt);
\filldraw [black] (B) circle (1pt);
\filldraw [black] (C) circle (1pt);
\draw (B) circle (2);
\end{tikzpicture}
\end{document}
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Shading a circle

Post by coachbennett1981 »

Thanks for the help. Is there a way to shade the whole quarter of the circle without having a line segment between AC?

Code: Select all

\begin{tikzpicture}[scale=2]
\coordinate [label=left:$B$] (B) at (0,0);
\coordinate [label=right: $C$] (C) at (2,0);
\coordinate [label=below:$A$] (A) at (0,-2);
\filldraw[black,fill=red] (B)--(A)--cycle;
\filldraw[black,fill=red] (B)--(C)--cycle;
\fill[red] (A) arc (270:360:2) -- cycle;
\filldraw [black] (A) circle (1pt);
\filldraw [black] (B) circle (1pt);
\filldraw [black] (C) circle (1pt);
\draw (B) circle (2);
\draw (1,.15) node{4 in=$r$};
\fill[red] (B)--(A)--(C)--cycle;
\end{tikzpicture}


User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Shading a circle

Post by shadgrind »

OK, I see what you mean now. Try this:

Code: Select all

\begin{tikzpicture}[scale=2]
\coordinate [label=left:$B$] (B) at (0,0);
\coordinate [label=right: $C$] (C) at (2,0);
\coordinate [label=below:$A$] (A) at (0,-2);
\filldraw[black,fill=red] (B)--(C) node[above,pos=0.5] {4 in=$r$} arc (360:270:2) -- cycle;
\filldraw [black] (A) circle (1pt);
\filldraw [black] (B) circle (1pt);
\filldraw [black] (C) circle (1pt);
\draw (B) circle (2);
\end{tikzpicture}
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Re: Shading a circle

Post by coachbennett1981 »

Thanks man!!! That's exactly what I was looking for. I am new to Pstricks and also Tikz. So many thanks..

Nick
Post Reply