# Draw arc in tikz when center of circle is specified

It would be convenient sometimes to be able to draw an arc in tikz by specifying

• the center of the corresponding circle
• the initial/final angle

i.e., the "natural" way an arc is defined, instead of the "first point of the arc".

Is there a way to do it?

• Nov 10, 2013 at 3:09
• I don't understand but none of the commands defined above works for me (I get "No PDF" and "Runaway argument?" ... "! Paragraph ended before \centerarc was complete.") But it works when I put in the tikzpicture : \filldraw [green!70!black,domain=105:435, fill opacity=0.2] (0,0) -- plot ({0.8*cos(\x)}, {0.8*sin(\x)})--(0,0); \draw [green!70!black,domain=105:435, fill opacity=0.2] plot ({0.7*cos(\x)}, {0.7*sin(\x)}); I tried the commands with/without the calc library. Thanks for any help Jul 19 at 21:02

You can use the parametrization

x(t)=a+r*cos(t)
y(t)=b+r*sin(t)


where r is the radius of the circle and (a,b) are the coordinates of its center. In Tikz this can be implemented as follows:

\documentclass[border=5mm]{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw [red,thick,domain=0:90] plot ({cos(\x)}, {sin(\x)});
\draw [blue,thick,domain=180:270] plot ({cos(\x)}, {sin(\x)});
\end{tikzpicture}

\end{document}


which produces Depending on your application, you might like to do this using the pgfplots package.

Also, in case this is used frequently, consider defining a custom command \centerarc as suggested in a comment by Tom Bombadil (this requires \usetikzlibrary{calc}):

\def\centerarc[#1](#2)(#3:#4:#5)% Syntax: [draw options] (center) (initial angle:final angle:radius)
{ \draw[#1] ($(#2)+({#5*cos(#3)},{#5*sin(#3)})$) arc (#3:#4:#5); }


Then use it by invoking

\centerarc[red,thick](0,0)(5:85:1)

• Clever solution! Aug 9, 2012 at 0:43
• Very nice, I used the idea to define this command: \def\centerarc[#1](#2)(#3:#4:#5)% [draw options] (center) (initial angle:final angle:radius) { \draw[#1] ($(#2)+({#5*cos(#3)},{#5*sin(#3)})$) arc (#3:#4:#5); } It. can be used e.g. likr this: \centerarc[red,thick](0,0)(5:85:1) Aug 21, 2012 at 22:35
• I don't really think this answer answers the questions, though Tom Bombadil's comment does. Feb 26, 2015 at 16:44
• Thanks, this was exactly what I was looking for. For those interesseted: I needed a filled arc drawn as a pie. In that case the centerarc definition needs a slight modification by adding the center point again: \def\centerarc[#1](#2)(#3:#4:#5)% { \draw[#1] ($(#2)+({#5*cos(#3)},{#5*sin(#3)})$) arc (#3:#4:#5) -- (#2); } Jan 8, 2021 at 11:13
• I've used this excellent answer for years. Now it seems you need \usetikzlibrary{calc} Aug 1, 2021 at 22:31

You should use a coordinate transformation for this, to get a proper starting point of the arc. Say, ([shift=(t:r)] x, y) is the proper starting point, where (x,y) is the center and (t:r) is the polar coordinate of starting point.

Full example: \documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw[help lines] (0,0) grid (4,3);
\draw (2,1) -- ++(30:2cm)
(2,1) -- ++(60:2cm);
% Draw the arc which center is (2,1)
\draw[thick,red] ([shift=(30:1cm)]2,1) arc (30:60:1cm);
\end{tikzpicture}

\end{document}

• Oh this is very clever. I'm going to use this technique to answer my own question here Aug 9, 2012 at 16:53

Notation: each arc is defined by <center>, <radius>, <init angle> and <final angle>.

If you want to be able to link several arcs in a single path, you can use shift with following syntax:

• initial point:([shift={(<init angle>:<radius>)}]<center>)

• to draw your arc: arc (<init angle>:<final angle>:<radius>)

Example (orange path uses proposed syntax and cyan path uses a style):

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[fill=orange]
([shift={(-40:1cm)}]-1.1,0) arc (-40:40:1cm)
--
([shift={(-40+180:1cm)}]1.1,0) arc (-40+180:40+180:1cm)
-- cycle;
\end{tikzpicture}
\begin{tikzpicture}
\tikzset{translate/.style={shift={(#1)}}}
\draw[fill=cyan]
([translate=-40:1cm]-1.1,0) arc (-40:40:1cm)
--
([translate=-40+180:1cm]1.1,0) arc (-40+180:40+180:1cm)
-- cycle;
\end{tikzpicture}
\end{document} Edit: a simpler notation!

Using calc TikZ library, you can use a simpler notation:

• initial point: ($(<center>) + (<init angle>:<radius>)$).

Example:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
% center c1
\coordinate (c1) at (0,0);

\draw[fill=green]
% radius=3mm, initial=0, final=90
%([shift={(0:3mm)}]c1) arc (0:90:3mm)
($(c1) + (0:3mm)$) arc (0:90:3mm)
--
($(c1) + (90:4mm)$) arc (90:0:4mm)
-- cycle;

\draw[fill=yellow]
% radius=4mm, initial=22.5, final=180
($(c1) + (22.5:4mm)$) arc (22.5:180:4mm)
--
($(c1) + (180:5mm)$) arc (180:22.5:5mm)
-- cycle;

% center c2
\coordinate (c2) at (0,12mm);

\draw[fill=red]
% radius=5mm, initial=45, final=270
($(c2) + (45:5mm)$) arc (45:270:5mm)
--
($(c2) + (270:6mm)$) arc (270:45:6mm)
-- cycle;

\draw[fill=gray]
% radius=6mm, initial=67.5, final=360
($(c2) + (67.5:6mm)$) arc (67.5:360:6mm)
--
($(c2) + (360:7mm)$) arc (360:67.5:7mm)
-- cycle;
\end{tikzpicture}
\end{document} • How to add proper head for this filled curve to make it look likes an arrow? Apr 3, 2015 at 2:50
• @CroCo Is it a new issue? So, ask a follow-up question... Apr 3, 2015 at 5:48
• The calc notation was exactly what I was looking for. Thanks! May 13, 2016 at 23:45

Possible is to use tkz-euclide. I f you want something independent of tkz-euclide you can take the code inside the file tkz-obj-arcs.tex. In each cases, I use the center

1) \tkzDrawArc and towards

towards is the option by defaut so it's not necessary to indicate this option. In the the example, the arc starts from A towards the axe OB.

 \begin{tikzpicture}[scale=1.5]
\tkzDefPoint(0,0){O}
\tkzDefPoint(2,-1){A}
\tkzDefPoint(1,1){B}
\tkzDrawArc[color=blue](O,A)(B)
\tkzDrawArc[color=Maroon](O,B)(A)
\tkzDrawArc(O,B)(A)
\tkzDrawLines[add = 0 and .5](O,A O,B)
\tkzDrawPoints(O,A,B)
\tkzLabelPoints[below](O,A,B)
\end{tikzpicture} 2) \tkzDrawArc and rotate

Here the center is O, the arc starts from A and the measure of the angle is 180 degrees.

\begin{tikzpicture}
\tkzDefPoint(0,0){O}
\tkzDefPoint(2,-2){A}
\tkzDefPoint(60:2){B}
\tkzDrawLines[add = 0 and .5](O,A O,B)
\tkzDrawArc[rotate,color=red](O,A)(180)
\tkzDrawPoints(O,A,B)
\tkzLabelPoints[below](O,A,B)
\end{tikzpicture} 3) \tkzDrawArc and R

In this case the center is O and you need to give the radius R and two angles

\begin{tikzpicture}
\tkzDefPoints{0/0/O}
\tikzset{compass style/.append style={<->}}
\tkzDrawArc[R, color=orange,double](O,3cm)(270,360)
\tkzDrawArc[R, color=blue,double](O,2cm)(0,270)
\tkzDrawPoint(O)
\tkzLabelPoint[below](O){$O$}
\end{tikzpicture} 4) \tkzDrawArc and R with nodes In this case, we need to know the center, the radius and the arc starts from the line BA towards the line BO

\begin{tikzpicture}
\tkzDefPoint(0,0){O}
\tkzDefPoint(2,-1){A}
\tkzDefPoint(1,1){B}
\tkzDrawArc[R with nodes](B,\radius pt)(A,O)
\end{tikzpicture} 5) \tkzDrawArc and delta

Useful to add an arc like with a compass.

\begin{tikzpicture}
\tkzInit
\tkzDefPoint(0,0){A} \tkzDefPoint(5,0){B} \tkzDefPointBy[rotation= center A%
angle 60](B) \tkzGetPoint{C}
\tkzSetUpLine[color=gray]
\tkzDefPointBy[symmetry= center C](A)
\tkzGetPoint{D}
\tkzDrawSegments(A,B A,D)
\tkzDrawLine(B,D)
\tkzSetUpCompass[color=orange]
\tkzDrawArc[delta=10](A,B)(C)
\tkzDrawArc[delta=10](B,C)(A)
\tkzDrawArc[delta=10](C,D)(D)
\tkzDrawPoints(A,B,C,D)
\tkzLabelPoints(A,B,C,D)
\tkzMarkRightAngle(D,B,A)
\end{tikzpicture} • I cannot get this code to work. I've loaded tkz-euclide, but LaTeX complains that \tkzDrawArc is not defined. Is there something else I need to load? Mar 16, 2014 at 14:46
• You need to add in the preamble \usetkzobj{arcs} or \usetkzobj{all} Mar 16, 2014 at 15:04
• @AlainMatthes Would like to reproduce Example (1) in plain TeX. I looked at tkz-obj-arcs.tex, but am confused about what to extract from that to translate to plain TeX. Please advise. Mar 16, 2014 at 18:06

You can create a new command, like this one

\documentclass[12pt]{standalone}
\usepackage{tikz}

\newcommand{\cercle}{
\node[circle,inner sep=0,minimum size={2*#2}](a) at (#1) {};
\draw[red,thick] (a.#3) arc (#3:{#3+#4}:#2);
}
\begin{document}
\begin{tikzpicture}

\coordinate (center) at (3,2);

\cercle{center}{2cm}{25}{-90}
![\cercle{4,5}{1cm}{15}{130}]

\end{tikzpicture}
\end{document} • I added line width and color to your command, and I find it pretty useful and very handy! Feb 26, 2015 at 16:22

Just repeat the first coordinate

\draw (1,2) +(-20:2) arc (-20:40:2) ;


which will draw an arc with the center at (1,2). (corrected)

• Welcome to TeX.SX! - You could use the code style. Use bracket button. Oct 3, 2018 at 16:20
• I think 1 from (-20:1) should be 2 or 2 from (-20:40:2) should be 1 because the displacement from center must coincide with radius. Oct 3, 2018 at 18:46
• I up-vote this, because it really works in polar coordinates (repeating the first coordinate). However, I don't understand the syntax (what is + ?) I used \draw (90:\R) arc (90:180:\R) in my case. May 26 at 10:00

A combination of Leo Liu's and cmhughes' solutions (ie, without the calc library):

\documentclass{standalone}
\usepackage{tikz}

\def\centerarc[#1](#2)(#3:#4:#5);%
%Syntax: [draw options] (center) (initial angle:final angle:radius)
{
%\draw[#1] ($(#2)+({#5*cos(#3)},{#5*sin(#3)})$) arc (#3:#4:#5);
\draw[#1]([shift=(#3:#5)]#2) arc (#3:#4:#5);
}

\begin{document}
\begin{tikzpicture}[>=stealth]
\draw[help lines] (-2,-2) grid (2,2);
\centerarc[thick,<->,blue](1,1)(70:195:1cm);
\centerarc[thick,blue](1,1)(-90:25:1cm);
\draw[thin,dashed,blue] (1,1) circle (1cm);
\centerarc[thick,<->,red](0,0)(165:285:2cm);
\centerarc[thick,red](0,0)(-45:45:2cm);
\draw[thin,dashed,red] (0,0) circle (2cm);
\end{tikzpicture}
\end{document}


Remark: As seen below, the <-> option in the \centerarc examples seems to distort the arcs themselves. I believe this is an unwanted effect, or even a bug. I added line width and color to your command @rpapa, I find it pretty useful and very handy! Coupled with some very simple polar coordinates, it can handle a lot.

\documentclass{standalone}
\usepackage{tikz}

\newcommand{\cercle}{
\node[circle,inner sep=0,minimum size={2*#2}](a) at (#1) {};
\draw[#6,line width=#5] (a.#3) arc (#3:{#3+#4}:#2);
}
% USAGE: \cercle {center} {radius in cm} {begin degrees} {value of the arc} {line width} {color}
% \coordinate (OO) at (2.8,2.2);
% \cercle{OO}{0.5cm}{-20}{60}{1.0pt}{blue};

\begin{document}

\begin{tikzpicture}
\coordinate (OR) at (0.00, 0.00);
\filldraw [orange] (OR) circle(2pt);
\node[above left, orange] at (OR) {\textbf{\textit{0}}};
\draw[step = 0.1cm, gray, ultra thin] (-1.5,-2) grid (1.5,2);
\draw[black, thin] (-1.5,0)--(1.5,0) (0,-2)--(0,2);
% 30 degree arc, starting at +15 degrees
\cercle {OR} {0.5cm} {15} {30} {1.00} {red};
\draw[red,thin] (OR) -- (pi/12 r:0.5);
\draw[red,thin] (OR) -- (pi/4 r:0.5);
% 75 degree arc, starting at -15 degrees
\cercle {OR} {1.0cm} {-15} {75} {1.50} {blue};
\draw[blue,thin] (OR) -- (-pi/12 r:1.0);
\draw[blue,thin] (OR) -- (pi/3 r:1.0);
% 90 degree arc, starting at -135 degrees
\cercle {OR} {1.5cm} {-135} {90} {2.00} {teal};
\draw[teal,thin] (OR) -- (-pi/4 r:1.5);
\draw[teal,thin] (OR) -- (-3*pi/4 r:1.5);
\end{tikzpicture}

\end{document} 