0

I have to make this graph

enter image description here I have only managed to make one part, the rest is very complicated to graph. The graph at the top is supposed to be a surface and I'm taking a small curved plate. Any idea or help please? One thing I would like is for the arrows to be blue, not black as it appears on my graphic. I tried fill=blue but no success.

\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, calc, arrows, decorations.markings, decorations.pathreplacing}

\tikzset{
on each segment/.style={
    decorate,
    decoration={
      show path construction,
      moveto code={},
      lineto code={
        \path [#1]
        (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);
      },
      curveto code={
        \path [#1] (\tikzinputsegmentfirst)
        .. controls
        (\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)
        ..
        (\tikzinputsegmentlast);
      },
      closepath code={
        \path [#1]
        (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);
      },
    },
  },
  % style to add an arrow in the middle of a path
  mid arrow/.style={postaction={decorate,decoration={
        markings,
        mark=at position .3 with {\arrow[#1]{stealth}},
        mark=at position .7 with {\arrow[#1]{stealth}}
      }}},
}

\begin{document}
\begin{tikzpicture}
    \clip (-1.7,-1.2) rectangle (1.7,1.2);
    \draw (-1.5,-1) rectangle (1.5,1);
    \draw (-2,0) -- (2,0);
    \draw[red] (0,-2) -- (0,2);
    \foreach \a in {-4,-3,...,3}
    \draw[postaction={on each segment={mid arrow=black}}, blue] (-2,1/8+\a/4) -- (2,1/8+\a/4);
    \draw[fill, red] (0,1) circle (0.3mm);
    \draw[fill, red] (0,-1) circle (0.3mm);
\end{tikzpicture}
\end{document}

Output: enter image description here

1 Answer 1

5

I will put my attempt here as an answer, I know I still have a lot to learn but here I leave it in case someone wants to see how it is done or wants to modify it:

\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, calc, arrows, decorations.markings, decorations.pathreplacing}

\tikzset{
on each segment/.style={
    decorate,
    decoration={
      show path construction,
      moveto code={},
      lineto code={
        \path [#1]
        (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);
      },
      curveto code={
        \path [#1] (\tikzinputsegmentfirst)
        .. controls
        (\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)
        ..
        (\tikzinputsegmentlast);
      },
      closepath code={
        \path [#1]
        (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);
      },
    },
  },
  % style to add an arrow in the middle of a path
  mid arrow/.style={postaction={decorate,decoration={
        markings,
        mark=at position .35 with {\arrow[#1]{stealth}},
        mark=at position .7 with {\arrow[#1]{stealth}}
      }}},
}

\begin{document}
\begin{tikzpicture}

    \foreach \s in {1/2} %scale
    {
    \foreach \c in {0} %Vertical displacement
    \foreach \d in {4*\s} %Horizontal displacement
    {
%Give color
    \fill[gray!50!white,opacity=0.2] (-3*\s+\c,2*\s+\d).. controls (-3*\s+\c,2*\s+\d) and (-3*\s+\c,4*\s+\d)..(-2*\s+\c,4.2*\s+\d)..controls (1*\s+\c,4*\s+\d) and (2*\s+\c,3.1*\s+\d)..(2*\s+\c,3.1*\s+\d).. controls (1*\s+\c,2*\s+\d) and (1*\s+\c,1*\s+\d)..(1*\s+\c,1*\s+\d).. controls (0+\c,2*\s+\d) and (-2*\s+\c,2*\s+\d)..(-3*\s+\c,2*\s+\d);
%contour
    \draw (-3*\s+\c,2*\s+\d).. controls (-3*\s+\c,2*\s+\d) and (-3*\s+\c,4*\s+\d)..(-2*\s+\c,4.2*\s+\d)..controls (1*\s+\c,4*\s+\d) and (2*\s+\c,3.1*\s+\d)..(2*\s+\c,3.1*\s+\d).. controls (1*\s+\c,2*\s+\d) and (1*\s+\c,1*\s+\d)..(1*\s+\c,1*\s+\d).. controls (0+\c,2*\s+\d) and (-2*\s+\c,2*\s+\d)..(-3*\s+\c,2*\s+\d);
%Surface drawing
    \draw (-4*\s+\c,-1*\s+\d)..controls (-6.5*\s+\c,-1.5*\s+\d) and (-6.5*\s+\c,2.5*\s+\d)..(-4*\s+\c,4*\s+\d)..controls (-1.1*\s+\c,5.9*\s+\d) and (2.5*\s+\c,4.8*\s+\d)..(5*\s+\c,2*\s+\d)..controls (6.5*\s+\c, 0.1*\s+\d) and (4*\s+\c,-4.5*\s+\d)..(2*\s+\c,-3*\s+\d)..controls (1.1*\s+\c,-2.5*\s+\d) and (-0.5*\s+\c,-0.5*\s+\d)..(-4*\s+\c,-1*\s+\d);
%Flow drawing
    \draw[postaction={on each segment={mid arrow=black}}, blue] (-3.5*\s+\c, 2.2*\s+\d)..controls (-1.8*\s+\c,2.8*\s+\d) and (0.5*\s+\c,2.1*\s+\d)..(1.8*\s+\c,1.1*\s+\d);
    \draw[postaction={on each segment={mid arrow=black}}, blue] (-3.4*\s+\c, 2.8*\s+\d)..controls (-1.5*\s+\c,3.1*\s+\d) and (0.4*\s+\c,2.7*\s+\d)..(1.9*\s+\c,1.7*\s+\d);
    \draw[postaction={on each segment={mid arrow=black}}, blue] (-3.2*\s+\c, 3.4*\s+\d)..controls (-1.6*\s+\c,3.7*\s+\d) and (0.8*\s+\c,3.1*\s+\d)..(2.1*\s+\c,2.1*\s+\d);
    \draw[postaction={on each segment={mid arrow=black}}, blue] (-2.9*\s+\c, 3.9*\s+\d)..controls (-0.9*\s+\c,4*\s+\d) and (0.8*\s+\c,3.7*\s+\d)..(2.2*\s+\c,2.6*\s+\d);
    \draw (-5.6*\s+\c,1.2*\s+\d)..controls (-5.7*\s+\c,-0.1*\s+\d) and (-5.4*\s+\c,-0.5*\s+\d)..(-4.7*\s+\c,-0.8*\s+\d);
    \draw (4.2*\s+\c,2.5*\s+\d)..controls (5*\s+\c,1.9*\s+\d) and (5.2*\s+\c,1.2*\s+\d)..(5.2*\s+\c,0.8*\s+\d);
    \draw[thick, red] (-1.3*\s+\c,1.1*\s+\d)..controls (-0.9*\s+\c,1.9*\s+\d) and (-0.9*\s+\c,3.9*\s+\d)..(0.4*\s+\c,4.2*\s+\d);
    }




    \foreach \x in {6*\s}
    \foreach \y in {-4*\s}
    {
    \fill[gray!50!white,opacity=0.2] (-3*\s+\x,-2*\s+\y) rectangle (3*\s+\x,2*\s+\y);
    \draw (-3*\s+\x,-2*\s+\y) rectangle (3*\s+\x,2*\s+\y);
    \draw (-4*\s+\x,\y) -- (4*\s+\x,\y);
    \draw[thick, red] (0+\x,-3*\s+\y) -- (0+\x,3*\s+\y);
    \foreach \a in {-2,-1,...,1}
    \draw[postaction={on each segment={mid arrow=black}}, blue] (-4*\s+\x,1/2*\s+\a/2+\y) -- (4*\s+\x,1/2*\s+\a/2+\y);
    \draw[fill, red] (0+\x,2*\s+\y) circle (0.4mm);
    \draw[fill, red] (0+\x,-2*\s+\y) circle (0.4mm);
    \node at (-3.6*\s+\x,-1/8+\y) {$-\varepsilon$};
    \node at (3.4*\s+\x,-1/8+\y) {$\varepsilon$};
    \node[above right] at (0*\s+\x,2*\s+\y) {$+1$};
    \node[below right] at (0*\s+\x,-2*\s+\y) {$-1$};
    }
    
    
    \foreach \a in {-6*\s}
    \foreach \b in {-4*\s}
    {
    \draw (-4*\s+\a,0+\b) -- (4*\s+\a,0+\b);
    \draw (0+\a,-4*\s+\b) -- (0+\a,4*\s+\b);
    \fill[gray!50!white,opacity=0.2] (-3*\s+\a,2*\s+\b)..controls (-1*\s+\a,3*\s+\b) and (0+\a,1*\s+\b)..(2*\s+\a,2*\s+\b)..controls (2*\s\a,2*\s\b) and (1*\s+\a,0+\b)..(3*\s+\a,-2*\s+\b)..controls (1*\s+\a,-2*\s+\b) and (-1*\s+\a,-1*\s+\b)..(-2*\s+\a,-3*\s+\b)..controls (-3*\s+\a,-2*\s+\b) and (-4*\s+\a,0+\b)..(-3*\s+\a,2*\s+\b); 
    \draw (-3*\s+\a,2*\s+\b)..controls (-1*\s+\a,3*\s+\b) and (0+\a,1*\s+\b)..(2*\s+\a,2*\s+\b)..controls (2*\s\a,2*\s\b) and (1*\s+\a,0+\b)..(3*\s+\a,-2*\s+\b)..controls (1*\s+\a,-2*\s+\b) and (-1*\s+\a,-1*\s+\b)..(-2*\s+\a,-3*\s+\b)..controls (-3*\s+\a,-2*\s+\b) and (-4*\s+\a,0+\b)..(-3*\s+\a,2*\s+\b);
    \draw[blue, postaction={on each segment={mid arrow=black}}] (-4*\s+\a,1*\s+\b)..controls (-3*\s+\a,2*\s+\b) and (0+\a,0+\b)..(3*\s+\a,2*\s+\b);
    \draw[blue, postaction={on each segment={mid arrow=black}}] (-4*\s+\a,0+\b)..controls (-2*\s+\a,1*\s+\b) and (0+\a,-1*\s+\b)..(3*\s+\a,1*\s+\b);
    \draw[blue, postaction={on each segment={mid arrow=black}}] (-4*\s+\a,-1*\s+\b)..controls (-3*\s+\a,0*\s+\b) and (1*\s+\a,-2*\s+\b)..(3*\s+\a,0+\b);
    \draw[blue, postaction={on each segment={mid arrow=black}}] (-4*\s+\a,-2*\s+\b)..controls (-2*\s+\a,-1*\s+\b) and (2*\s+\a,-2*\s+\b)..(3*\s+\a,-1*\s+\b);
    
    \draw[thick, red] (-2*\s+\a,3*\s+\b)..controls (0+\a,2*\s+\b) and (-2*\s+\a,-1*\s+\b)..(2*\s+\a,-3*\s+\b);
    
    \node at (-4*\s+\a,2.5*\s+\b) {$\mathbf{x}_\alpha(U_\alpha)$};
    }
    
    \draw[-stealth] (-1*\s, -2) to ++(2*\s,0);
    \node at (0,-1.75) {$h$};
    
    \draw[-stealth] (-2.4*\s,5.6*\s) to[bend right] ++(-2*\s,-7*\s);
        \node at (-2.6,0.9) {$\mathbf{x}_\alpha$};
        
    \draw[-stealth] (4.6*\s, -1.7*\s) to[bend right] ++(-3.2*\s,6.4*\s);
    \node at (2.5,0.2) {$\delta$};
    \node at (2,4) {$M$};
    \node at (0.4,4.12) {\textcolor{red}{$\Sigma$}};
    }
    
\end{tikzpicture}
\end{document}

Output: 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.