I am trying to draw a cylinder to represent a database in a diagram of mine. I have written this code, inside a much bigger document
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,shapes.geometric}
\begin{document}
\begin{tikzpicture}[node distance=5cm]
\node (db1) [cylinder,
draw=black,
fill=blue!30,
aspect=0.8,
minimum width=2cm,
minimum height=1.5cm,
shape border rotate=90] {SOME TEXT};
\node (db2) [cylinder,
draw=black,
fill=blue!30,
aspect=0.8,
minimum width=2cm,
minimum height=1.5cm,
shape border rotate=90,
right of=db1] {};
\end{tikzpicture}
\end{document}
However, the addition of text seems to break the aspect ratio. The output I get is this
Did I do something wrong or is this the expected behavior? I needed the cylinder like the second image, but having some text inside.
Best Answer
Try a lower value for
aspect
. Here it is with value of0.25
. The closer it's to 1, the more like yours. If you tried0.10
it would almost be a rectangular shape.Output
Code