6

I'm trying to draw a unit circle using plus and minus signs to draw arcs.I'm teaching goniometric inequalities to my students. I'm using parametric plots to draw arcs but I can't draw +/-. It would be good to choose the density of signs and rotate signs to follow arcs. Can anyone help me?

3
  • 1
    Something like \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{decorations.text} \begin{document} \begin{tikzpicture} \draw[decorate,decoration={text along path,text={+++++++++++++++++}, text align=fit to path}] (0,0) circle[radius=1cm]; \end{tikzpicture} \end{document}? If not, could you please try to explain your question more?
    – user194703
    Commented Nov 4, 2019 at 19:55
  • Yes! I have to study decorations library.
    – ozymandias
    Commented Nov 4, 2019 at 20:07
  • 2
    I knew my mandala code would be useful at some point in time: tex.stackexchange.com/a/496417/117050
    – Skillmon
    Commented Nov 4, 2019 at 20:08

2 Answers 2

6

My comment from above with a style that makes repetition easy. E.g. to have 17 pluses along the unit circle, you only need to say

\draw[repeat along closed path={17}{+}]  (0,0) circle[radius=1cm];

i.e. the first argument is the number of repetitions and the the second the symbol (or symbols) you are going to repeat.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{decorations.text}
\newcounter{pft}
\newcommand{\Repeat}[3]{\setcounter{pft}{1}%
\edef#3{#2}%
\loop\stepcounter{pft}\edef#3{#3#2}\ifnum\value{pft}<#1\repeat}
\begin{document}
\begin{tikzpicture}[repeat along path/.style 2 args={
 /utils/exec=\Repeat{#1}{#2}{\mytext},
 decorate,decoration={text along path,text={{}\mytext{}},
 text align=fit to path}},
 repeat along closed path/.style 2 args={
 /utils/exec=\Repeat{#1}{#2}{\mytext},
 decorate,decoration={text along path,text={\mytext{}},
 text align=fit to path}}]
 \draw[repeat along closed path={17}{+}]  (0,0) circle[radius=1cm];
 \draw[repeat along path={9}{-},/pgf/decoration/raise=-3pt] (2,0) arc(-180:0:1);
 \draw[repeat along path={9}{+}] (2,0) arc(180:0:1);
 \draw[repeat along closed path={9}{+-}]  (6,0) circle[radius=1cm];
\end{tikzpicture}
\end{document}

enter image description here

5

For fun: it is very easy with pstricks:

\documentclass[svgnames, x11names, border=3pt]{standalone}
\usepackage{pst-plot, multido}
\usepackage{auto-pst-pdf}

\begin{document}

\begin{pspicture*}(-2.5,-2.5)(2.5,2.8)
\psset{algebraic, arrowinset=0.125, arrowsize=3pt, linejoin=1}
\psaxes[linecolor=OrangeRed2! 80, ticks=none, labels=none, arrows =-> ](0,0)(-2.5,-2.5)(2.5,2.8) [$x$,-135] [$y$,-135]
\uput[dl](0,0){$O$}
\psset{linewidth=1.5pt, linecolor=DarkOliveGreen3, plotpoints=100,dotstyle= + }
\multido{\iangle= 0+9}{21}{\psdot[dotstyle=+](2;\iangle)}
\multido{\iangle= 189+9}{19}{\psdot[dotstyle=|, dotangle=90, linecolor=Gold](2;\iangle)}

\end{pspicture*}

\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .