4

I want to draw a Disk/Storage icon as follows:

enter image description here


I was able to come up with:

\documentclass[eblocbroker.tex]{subfiles}
\begin{document}
\begin{figure}[!htp]
    \centering
    \begin{tikzpicture}[%
        >=latex,shorten >=2pt,shorten <=2pt,shape aspect=1,
        arrow/.style={<->, >=stealth, semithick},
        block/.style={},
        every node/.style = {font=\normalsize}
        ]

        \node[
        cylinder,shape border rotate=90,draw,fill=white,
        shape aspect=0.2,font={\baselineskip=9pt},inner xsep=3pt,
        align=center,xshift=30mm,yshift=-2mm] (A) {%
            Cloud Storage \\
            \textit{...} \\
            \textit{...}
        };
        \node[
        cylinder,shape border rotate=90,draw,fill=white,yshift=-2.7mm,
        shape aspect=0.2,font={\baselineskip=9pt},inner xsep=3pt,
        align=center,xshift=30mm,yshift=-2mm] (C) {%
            Cloud Storage
        };

        \node[
        cylinder,shape border rotate=90,draw,fill=white,yshift=2.7mm,
        shape aspect=0.2,font={\baselineskip=9pt},inner xsep=3pt,
        align=center,xshift=30mm,yshift=-2mm] (B) {%
            Cloud Storage
        };


        \node[draw,circle,dashed,inner sep=-1.2pt,draw=gray!50,thick,fit=(A)] (D) {};

    \end{tikzpicture}
\end{figure}
\end{document}

Output:

enter image description here

I was not able to draw sub-cyclinder in the middle. I keep the text in between to keep cyclinder's width.

1 Answer 1

4

Draw the nodes from bottom to top. I suggest defining a style for repeated use. Include minimum width to keep all cylinders the same size. You can use the positioning library with negative node distance for easy placement. You can use \phantom text to keep the empty cylinder with the same aspect.

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, positioning, fit}

\tikzset{mycylinder/.style={cylinder, shape border rotate=90, aspect=0.2, draw, fill=white, minimum width=2.5cm}}

\begin{document}
\begin{figure}
    \centering
    \begin{tikzpicture}[node distance=-4mm]
        \node[mycylinder] (C) {Cloud Storage};
        \node[mycylinder, above=of C] (A) {\phantom{Cloud Storage}};
        \node[mycylinder, above=of A] (B) {Cloud Storage};
        \node[draw, circle, dashed, inner sep=-1.2pt, draw=gray!50, thick, fit=(A)(B)(C)] (D) {};
    \end{tikzpicture}
\end{figure}
\end{document}
5
  • How can we keep same width height without Cloud Storage string is typed , like having white space instead?
    – alper
    Commented May 29, 2023 at 20:22
  • @alper: I edited my response.
    – Sandy G
    Commented May 29, 2023 at 20:30
  • Can we apply same approch for a rectangle instead of a cyclinder?
    – alper
    Commented May 29, 2023 at 21:57
  • @alper: Do you mean a rectangular solid? There is no such built-in node shape that I know of. I suggest you make a hand-drawn sketch and post it as a new question.
    – Sandy G
    Commented May 29, 2023 at 23:23
  • Yes sir the rectangle on top would be a solid. Please see: tex.stackexchange.com/questions/687154/…
    – alper
    Commented May 30, 2023 at 6:33

You must log in to answer this question.

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