9

I want to redraw this picture with TikZ:

enter image description here

But I have problems with the line which is circled. I know how to draw “normal“ wavy lines, but that's not that what I want to achieve. Here is my MWE:

\documentclass[border=5pt,tikz]{standalone}
\usetikzlibrary{arrows,patterns}
\begin{document}
    \begin{tikzpicture}[>=stealth]
        \draw (1.75,1) --+ (0,-1) node[below] {$I$};
        \draw (2*1.75,1.5) --+ (0,-1.5) node[below] {$I\!I$};
        \draw (3*1.75,2) --+ (0,-2) node[below] {$I\!I\!I$};
            \draw (3.1,-1) --+ (0,1);
                \draw[<->] (3.1,-.9) --+ (-3.1,0) node[midway,fill=white] {$x_1$};
            \draw[ultra thin] (0,-1.5) -- (0,2);
            \draw[ultra thin] (7,-1.5) -- (7,0);
                \begin{scope}
                    \fill[white] (0,0) rectangle (7,.5);
                        \clip[draw] (0,0) rectangle (7,.5);
                        \foreach \x in {0,.2,...,7}
                        {
                            \draw (\x,0) -- (\x,.5);
                        }
                \end{scope}
                    \draw (-.2,-.2) -- (0,0) -- (.2,-.2);
                        \draw[thick] (-.3,-.2) -- (.3,-.2);
                        \draw[fill=white] (0,0) circle(.07);
                    \fill[pattern=north east lines] (-.3,-.2) rectangle (.3,-.3);
                        \begin{scope}[shift={(7,0)}]
                            \draw (-.2,-.2) -- (0,0) -- (.2,-.2);
                                \draw (-.3,-.2) -- (.3,-.2);
                                \draw[fill=white] (0,0) circle(.07);
                            \draw[fill=white] (-.2,-.3) circle(.05);
                            \draw[fill=white] (0,-.3) circle(.05);
                            \draw[fill=white] (.2,-.3) circle(.05);
                                \draw[thick] (-.3,-.4) -- (.3,-.4);
                                \fill[pattern=north east lines] (-.3,-.4) rectangle (.3,-.5);
                        \end{scope}
             \draw[<->] (0,.9) -- (1.75,.9) node[midway,fill=white] {$\frac{l}{4}$};
             \draw[<->] (0,1.4) -- (2*1.75,1.4) node[midway,fill=white] {$\frac{l}{2}$};
             \draw[<->] (0,1.9) -- (3*1.75,1.9) node[midway,fill=white] {$\frac{3l}{4}$};
                 \draw[<->] (0,-1.4) -- (7,-1.4) node[midway,fill=white] {$l$};
    \end{tikzpicture}
\end{document}

and here the output:

enter image description here

1 Answer 1

11

You could use random steps that comes with decorations.pathmorphing along with rounded corners, as pointed out in this nice answer by Torbjørn T..

\documentclass[border=5pt,tikz]{standalone}
\usetikzlibrary{arrows,patterns,decorations.pathmorphing}
\begin{document}
    \begin{tikzpicture}[>=stealth]
        \draw (1.75,1) --+ (0,-1) node[below] {$I$};
        \draw (2*1.75,1.5) --+ (0,-1.5) node[below] {$I\!I$};
        \draw (3*1.75,2) --+ (0,-2) node[below] {$I\!I\!I$};
            \draw (3.1,-1) --+ (0,1);
                \draw[<->] (3.1,-.9) --+ (-3.1,0) node[midway,fill=white] {$x_1$};
            \draw[ultra thin] (0,-1.5) -- (0,2);
            \draw[ultra thin] (7,-1.5) -- (7,0);
                \begin{scope}
                    \fill[white] (0,0) rectangle (7,.5);
                        \clip[draw] (0,0) rectangle (7,.5);
                        \foreach \x in {0,.2,...,7}
                        {
                            \draw (\x,0) -- (\x,.5);
                        }
                \end{scope}
                    \draw (-.2,-.2) -- (0,0) -- (.2,-.2);
                        \draw[thick] (-.3,-.2) -- (.3,-.2);
                        \draw[fill=white] (0,0) circle(.07);
                    \fill[pattern=north east lines] (-.3,-.2) rectangle (.3,-.3);
                        \begin{scope}[shift={(7,0)}]
                            \draw (-.2,-.2) -- (0,0) -- (.2,-.2);
                                \draw (-.3,-.2) -- (.3,-.2);
                                \draw[fill=white] (0,0) circle(.07);
                            \draw[fill=white] (-.2,-.3) circle(.05);
                            \draw[fill=white] (0,-.3) circle(.05);
                            \draw[fill=white] (.2,-.3) circle(.05);
                                \draw[thick] (-.3,-.4) -- (.3,-.4);
                                \fill[pattern=north east lines] (-.3,-.4) rectangle (.3,-.5);
                        \end{scope}
             \draw[<->] (0,.9) -- (1.75,.9) node[midway,fill=white] {$\frac{l}{4}$};
             \draw[<->] (0,1.4) -- (2*1.75,1.4) node[midway,fill=white] {$\frac{l}{2}$};
             \draw[<->] (0,1.9) -- (3*1.75,1.9) node[midway,fill=white] {$\frac{3l}{4}$};
             \draw[<->] (0,-1.4) -- (7,-1.4) node[midway,fill=white] {$l$};
             \draw[decorate,decoration={random steps,segment
             length=2pt,amplitude=1pt},rounded corners=1pt]
              (3.1,0) -- (3.1,0.6);
    \end{tikzpicture}
\end{document}

enter image description here

1
  • Yes, in the screenshot there are used rounded corners. Thank you! Aug 2, 2018 at 12:25

You must log in to answer this question.

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