我想要绘制一个Disk
/Storage
图标,如下所示:
我想出了:
\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}
输出:
我无法在中间绘制子圆柱体。我将文本保留在中间以保持圆柱体的宽度。
答案1
从下往上绘制节点。我建议定义一个style
以供重复使用。包含minimum width
以保持所有圆柱体大小相同。您可以使用positioning
带负片的库node distance
来轻松放置。您可以使用\phantom
文本来保持空圆柱体具有相同的方面。
\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}