0

I am trying to recreate this diagram (drawn in a WYSIWYG program and didn't spend a lot of time on it:

The 25cm label describes the height of the pipe (filled with different types of sand / rock). The 8cm describes the width of the pipe.

Here is my .tex ...

\documentclass[12pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}[>=latex,shorten >=2pt,shorten <=2pt,shape aspect=1]

\node [cylinder,shape border rotate=90,minimum height=1cm,minimum width=8cm,draw] (grob){Grob};

\node [cylinder,shape border rotate=90,minimum height=1cm,minimum width=8cm,draw,below of= grob] (mittelgrob){MittelGrob};

\node [cylinder,shape border rotate=90,minimum height=1cm,minimum width=8cm,draw=black,below of=mittelgrob] (Aktivkohle){Aktivkohle};

\node [cylinder,shape border rotate=90,minimum height=1cm,minimum width=8cm,draw=black,below of=Aktivkohle] (mittelfein){MittelFein};

\node [cylinder,shape border rotate=90,minimum height=1cm,minimum width=8cm,draw=black,below of=mittelfein] (fein){Fein};

\node [cylinder,shape border rotate=90,minimum height=1cm,minimum width=8cm,draw=black,below of=fein] (tuch){Tuch};

\draw [<->] (tuch) -- (tuch) node [midway, above,fill=white] {$8cm$};

\end{tikzpicture}
\end{document}

which compiles to this PDF:

Once I get the basics, I want to have different patterns (dense dots=fine sand, spaced out dots=coarser sand) and the labels of the different parts be on the right.

Thanks for your help.

3

AFAIK one needs to declare new patterns to be able to adjust the density and so on. tikz-3dplot allows you to adjust the view angles.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{calc,patterns}
\makeatletter
\newlength{\flex@pattern@density}
\newlength{\flex@pattern@linewidth}
\newlength{\flex@pattern@auxlength}
\newlength{\flex@pattern@auxlengthtwo}
\tikzset{/tikz/.cd,
    pattern density/.code={\flex@pattern@density=#1
    \flex@pattern@auxlength=1.1\flex@pattern@density
    \flex@pattern@auxlengthtwo=\flex@pattern@density
    \advance\flex@pattern@auxlengthtwo by 0.1pt
    %\typeout{\the\flex@pattern@density,\the\flex@pattern@auxlength}
    },
    pattern density=3pt,
    pattern line width/.code={\flex@pattern@linewidth=#1},
    pattern line width=0.4pt,
}
\pgfdeclarepatternformonly[\flex@pattern@density,\flex@pattern@linewidth,\tikz@pattern@color]{flexible dots}{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{1pt}{1pt}}{\pgfqpoint{\flex@pattern@density}{\flex@pattern@density}}%
{
  \pgfsetcolor{\tikz@pattern@color}
  \pgfpathcircle{\pgfqpoint{0pt}{0pt}}{\flex@pattern@linewidth}
  \pgfusepath{fill}
}
\makeatother
\begin{document}
\tdplotsetmaincoords{100}{0}
\begin{tikzpicture}[tdplot_main_coords]
  \pgfmathsetmacro{\R}{4}
  \pgfmathsetmacro{\HW}{4}
  \pgfmathsetmacro{\HC}{12}
  % \X=label, \Y=upper height in cm, \Z=distance between dots
  \foreach \X/\Y/\Z [remember=\Y as \LastY (initially 0)] in {Tuch/1.5/1,
   Fein/3.5/3,
   MittelFein/5.5/4,
   Aktivkohle/8/5,
   MittelGrob/11/7,
   Grob/12/9}
     {%\typeout{\X,\Y,\LastY}
     \draw[pattern=flexible dots,pattern density=\Z pt,pattern line width=0.4pt] 
     plot[variable=\x,domain=0:180,smooth]
     ({\R*cos(\x)},{\R*sin(\x)},\LastY) --
     plot[variable=\x,domain=180:0,smooth]
     ({\R*cos(\x)},{\R*sin(\x)},\Y) -- cycle;
     \node[anchor=west] at (\R,0,{(\Y+\LastY)/2}){\X};
      }
  \draw plot[variable=\x,domain=0:180,smooth]
  ({\R*cos(\x)},{\R*sin(\x)},0) 
  -- 
  plot[variable=\x,domain=180:360,smooth]
  ({\R*cos(\x)},{\R*sin(\x)},\HC) -- cycle;
  \draw plot[variable=\x,domain=0:180,smooth]
  ({\R*cos(\x)},{\R*sin(\x)},\HC); 
  \draw (-1.1*\R,0,0) -- (-1.1*\R,0,\HC) node[midway,sloped,above]{25cm};
  \draw (-\R,\R,0,-0.2) -- (\R,\R,-0.2) node[midway,sloped,below]{8cm};
\end{tikzpicture}
\end{document}

enter image description here

  • 1
    Wow! I just noticed the 100k! Congrats! Well deserved! ;-) – gusbrs Feb 15 at 20:26
  • Thank you, @marmot. This is what I wanted. Now I just have to figure out how to implement the label lines (25cm and 8cm) with arrows. – Max R Feb 15 at 21:18
  • @MaxR You're welcome, I added some labels. JouleV.s nice answer has a nice way to add them (but here it is arguably advantageous to use 3d coordinates). – user121799 Feb 15 at 21:38
2

Maybe this will give you some way to draw

\documentclass[tikz,margin=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[scale=0.5]
\foreach \i in {0,10,16,20,22} { % Add y-coordinates
    \draw (0,\i) arc (360:180:8cm and 3cm);
    \draw[dashed] (0,\i) arc (0:180:8cm and 3cm);
}
\draw (0,25) arc (0:360:8cm and 3cm);
\draw (-16,0)--(-16,25) (0,0)--(0,25);
\draw (-17,0)--(-17,25) node[midway,above,rotate=90] {25 cm};
\draw (-16,-3.5)--(0,-3.5) node[midway,below] {8 cm};
\end{tikzpicture}
\end{document}

enter image description here

0

After some more tweaking I got this .tex:

\documentclass[tikz,border=2pt,12pt]{standalone}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}[scale=0.15]
\foreach \i in {0,5,10,15,20,25,30} {
    \draw [thick] (0,\i) arc (360:180:6cm and 2cm);
    \draw[dashed,ultra thin] (0,\i) arc (0:180:6cm and 2cm);
}
\draw [thick](0,30) arc (0:360:6cm and 2cm);
\draw [thick](-12,0)--(-12,30) (0,0)--(0,30);
\draw [|{Stealth}-{Stealth}|](-13,0)--(-13,30) node[midway,above,rotate=90] {25 cm};
\draw [|{Stealth}-{Stealth}|](-12,-3)--(0,-3) node[midway,below] {8 cm};

\draw (0,0)--(0,5) node[midway,right] {vi};
\draw (0,5)--(0,10) node[midway,right] {v};
\draw (0,10)--(0,15) node[midway,right] {iv};
\draw (0,15)--(0,20) node[midway,right] {iii};
\draw (0,20)--(0,25) node[midway,right] {ii};
\draw (0,25)--(0,30) node[midway,right] {i};
\end{tikzpicture}
\end{document}

which typesets to: Screenshot (the Roman numerals correspond to different items in the text)

I'm glad at how it turned out. It is compact and concise. If you have any tips for the appearance, please share! Thanks.

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.