3

I am looking to change the pattern of a segment in the middle of it or after a predefined distance in cm or pt for example.

I have tried to look at the draw pattern but without finding any good solutions.

Does anyone have any ideas?

Before

After

Here is the basic code :

\documentclass[border=1cm]{standalone}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
    \node at (0,0) [circle,draw]{$t_1$};
    \node at (1.5,0) [circle,draw]{$t_2$};
    \node at (3,0) [circle,draw]{$t_3$};
    \node at (4.5,0) [circle,draw]{$t_4$};
    \node at (6,0) [circle,draw]{$t_4$};
    \draw [color=red!100,line width=1pt](0,-0.4)  to [bend right=45] (1.5,-0.4);
    \draw [color=red!100,line width=1pt](1.5,-0.4) to [bend right=45] (3,-0.4);
    \draw [color=red!100,line width=1pt](3,-0.4) to [bend right=45] (4.5,-0.4);
    \draw [color=red!100,line width=1pt](4.5,-0.4) to [bend right=45] (6,-0.4);
    \draw [color=blue!100,line width=1pt](0,-0.4) to [bend right=45] (3,-0.4);
    \draw [color=green!100,line width=1pt](0,-0.4) to [bend right=45] (3,-0.4);

    \draw [color=blue!100,line width=1pt](0,0.4) to [bend left=45] (6,0.4);
\end{tikzpicture}

\end{document}
3

First I would label the states so you don't have to care about finding the edges of the circles. I draw from the south and north ends of the circles to get the same view as in the example, but you can skip those also. To make the line with the dotted mid-part you can start by drawing it as a solid line and then removing the mid part with a white rectangle. Then draw the dashed line.

\documentclass[border=1cm]{standalone}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
    \node at (0,0) [circle,draw] (t1) {$t_1$};
    \node at (1.5,0) [circle,draw] (t2) {$t_2$};
    \node at (3,0) [circle,draw] (t3) {$t_3$};
    \node at (4.5,0) [circle,draw] (t4) {$t_4$};
    \node at (6,0) [circle,draw] (t5) {$t_5$};
    \draw [color=red!100,line width=1pt](t1.south)  to [bend right=45] (t2.south);
    \draw [color=red!100,line width=1pt](t2.south) to [bend right=45] (t3.south);
    \draw [color=red!100,line width=1pt](t3.south) to [bend right=45] (t4.south);
    \draw [color=red!100,line width=1pt](t4.south) to [bend right=45] (t5.south);
    %%\draw [color=blue!100,line width=1pt](0,-0.4) to [bend right=45] (3,-0.4);
    \draw [color=green!100,line width=1pt](t1.south) to [bend right=45] (t3.south);

    \draw [color=blue!100,line width=1pt](t1.north) to [bend left=45] (t5.north);
    \fill[white] (1.9,1) rectangle (4.1,2);
    \draw [color=blue!100,line width=1pt,dashed](t1.north) to [bend left=45] (t5.north);
        
\end{tikzpicture}

\end{document}

If you don't know the color of the background you can first draw the dotted line and use \clip inside a scope to cut out the start and end as solid lines.

\documentclass[border=1cm]{standalone}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
    \node at (0,0) [circle,draw] (t1) {$t_1$};
    \node at (1.5,0) [circle,draw] (t2) {$t_2$};
    \node at (3,0) [circle,draw] (t3) {$t_3$};
    \node at (4.5,0) [circle,draw] (t4) {$t_4$};
    \node at (6,0) [circle,draw] (t5) {$t_5$};
    \draw [color=red!100,line width=1pt](t1.south)  to [bend right=45] (t2.south);
    \draw [color=red!100,line width=1pt](t2.south) to [bend right=45] (t3.south);
    \draw [color=red!100,line width=1pt](t3.south) to [bend right=45] (t4.south);
    \draw [color=red!100,line width=1pt](t4.south) to [bend right=45] (t5.south);
    %%\draw [color=blue!100,line width=1pt](0,-0.4) to [bend right=45] (3,-0.4);
    \draw [color=green!100,line width=1pt](t1.south) to [bend right=45] (t3.south);

    \draw [color=blue!100,line width=1pt,dashed](t1.north) to [bend left=45] (t5.north);
    \begin{scope}
      \clip (-0.1,0) rectangle (1.9,2);
      \draw [color=blue!100,line width=1pt](t1.north) to [bend left=45] (t5.north);
    \end{scope}
    \begin{scope}
      \clip (4.1,0) rectangle (6.1,2);
      \draw [color=blue!100,line width=1pt](t1.north) to [bend left=45] (t5.north);
    \end{scope}
\end{tikzpicture}

\end{document}

Both examples give the same picture:

enter image description here

7

A fast solution would be to cut the arc in three segments like this:

\documentclass[border=1cm]{standalone}

\usepackage{tikz}

\begin{document}
        
    \begin{tikzpicture}
        \node at (0,0) [circle,draw]{$t_1$};
        \node at (1.5,0) [circle,draw]{$t_2$};
        \node at (3,0) [circle,draw]{$t_3$};
        \node at (4.5,0) [circle,draw]{$t_4$};
        \node at (6,0) [circle,draw]{$t_4$};
        \draw [color=red!100,line width=1pt](0,-0.4)  to [bend right=45] (1.5,-0.4);
        \draw [color=red!100,line width=1pt](1.5,-0.4) to [bend right=45] (3,-0.4);
        \draw [color=red!100,line width=1pt](3,-0.4) to [bend right=45] (4.5,-0.4);
        \draw [color=red!100,line width=1pt](4.5,-0.4) to [bend right=45] (6,-0.4);
                
        \draw [color=green!100,line width=1pt](0,-0.4) to [bend right=45] (3,-0.4);
        \draw [color=blue!100,line width=1pt](0,0.4) to [bend left=12.5] (2,1.5);
        \draw [dashed,color=blue!100,line width=1pt,shorten <=3](2,1.5) to [bend left=12.5] (4,1.5);
        \draw [color=blue!100,line width=1pt](4,1.5) to [bend left=12.5] (6,0.4);

    \end{tikzpicture}
    
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.