I would like to make the graph of this curve with Tikz; I am not quite sure how to do the diagram, detailing of the arrows and points. I would really appreciate your help.
2 Answers
This is almost literally copied from section 50.6.1 of the pgf manual.
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[decoration={markings,% switch on markings
mark=between positions 0.1 and 0.9 step 12mm with {\arrow{stealth}}},
dot/.style={circle,inner sep=1pt,fill}]
\draw[postaction={decorate},red] (0,0) node[dot,label=right:{$P_2(2,2)$}]{}
arc[start angle=45,end angle=-135,radius=2]
node[dot,label=left:{$P_2(-2,-2)$}]{}
-- cycle;
\end{tikzpicture}
\end{document}
-
My post overlapped with yours. But I see you did essentially the same thing I did. May I suggest placing the decorations into its own style with
tikzset
as I did in my solution? I will delete mine since it's so similar and you posted first. Also, you may want to add the\gamma
label to the arc.– Sandy GNov 23, 2021 at 1:31 -
1@SandyG Thanks for the heads up! I do not see a reason why you want to remove your nice answer. As for the style, yes, you can define a global style, and in many situations this is precisely what you want. However, there can also be a benefit from having the definition local, which the example in the pgf manual and this answer does.– user255043Nov 23, 2021 at 4:49
It is often useful to use \tikzset
for a style you will use more than once. In the code below, adding multarrow
to \draw
options will add five arrows to the path.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\tikzset{multarrow/.style={decoration={markings,mark=between positions 0.1 and 1 step 0.2 with {\arrow{>}}},postaction={decorate}}}
\begin{document}
\begin{tikzpicture}
\draw[multarrow, red, thick] (-2,-2)node[fill, circle, inner sep=1pt, label={[below left] $P_1(-2,-2)$}]{}
-- (2,2)node[fill, circle, inner sep=1pt, label={[right] $P_2(2,2)$}]{}
arc(45:-135:{2*sqrt(2)})node[below right, pos=.3]{$\gamma$};
\end{tikzpicture}
\end{document}