TikZ PGF – How to Draw an Infinitesimal Portion of a Surface

diagramstikz-pgf

I'm trying to draw the following figures using TikZ, and I've found some issues :

enter image description here

Here's my attempt :

    \begin{tikzpicture}
\def\a{2} 
\def\b{1} 
\def\h{6}
\draw[->] (0,0)--(-\a,0) node[midway, above]{$r$};
\filldraw (0,0) circle(1pt); 
\filldraw (0,\h) circle(1pt); 
\draw[dashed, ->] (0,\h)--(0,\h+2) node[left] {$d\vec{S}$};
\draw[blue, thick] (\a,0)--(\a,\h) (-\a,0)--(-\a,\h);
\draw[dashed,blue, thick] (\a,0) arc [x radius=\a, y radius=\b, start angle=0, end angle=180];
\draw[blue, thick] (-\a,0) arc [x radius=\a, y radius=\b, start angle=180, end angle=360];
\draw[blue, thick]  (0,\h) ellipse (\a cm and \b cm);
\draw[->] (0,\h)--(3,\h) node[above, midway] {$\vec{E}$}; 
\draw[ultra thick] (0,0)--(0,\h) node[midway, left] {$\lambda >0$};
\end{tikzpicture}

enter image description here

And I need to draw some other figures, such as :

enter image description here

My problem is always that surface portion. Any thoughts ?

Best Answer

Old notation: circle(1pt) and new notation: circle[radius=1 pt]. You make me anxious when you mix them.

\documentclass[tikz, border=1 cm]{standalone}
\begin{document}
\begin{tikzpicture}
\def\a{2} 
\def\b{1} 
\def\h{6}
\draw[->] (0,0)--(-\a,0) node[midway, above]{$r$};
\filldraw (0,0) circle[radius=1 pt]; 
\filldraw (0,\h) circle[radius=1 pt]; 
\draw[dashed, ->] (0,\h)--(0,\h+2) node[left] {$d\vec{S}$};
\draw[blue, thick] (\a,0)--(\a,\h) (-\a,0)--(-\a,\h);
\draw[dashed,blue, thick] (\a,0) arc[x radius=\a, y radius=\b, start angle=0, end angle=180];
\draw[blue, thick] (-\a,0) arc[x radius=\a, y radius=\b, start angle=180, end angle=360];
\draw[blue, thick]  (0,\h) ellipse[x radius=\a, y radius=\b];
\draw[->] (0,\h)--(3,\h) node[above, midway] {$\vec{E}$}; 
\draw[ultra thick] (0,0)--(0,\h) node[midway, left] {$\lambda >0$};
\draw[red, thick, fill=pink, opacity=0.5]
  ({\a*cos(-80)},{\b*sin(-80)+4}) arc[x radius=\a, y radius=\b, start angle=-80, end angle=-60] --
  ({\a*cos(-60)},{\b*sin(-60)+3.4}) arc[x radius=\a, y radius=\b, start angle=-60, end angle=-80] -- cycle;
\draw[red, thick, ->] ({\a*cos(-70)},{\b*sin(-70)+3.7}) -- ({2*\a*cos(-70)},{2*\b*sin(-70)+3.7}) node[above right, midway]{$\vec{E}$};
\end{tikzpicture}
\end{document}

Cylinder with small surface area

Related Question