# Weird behavior of cylinder shape in TikZ

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.

• I believe this has to do with the fact that the node shape was designed to be horizontal, so the text width is used for determining the length of the cylinder (not the width). If you don't need the shape to adapt its width automatically, you can leave the node text empty and instead use label=center:SOME TEXT in the node options to place the text. – Jake May 3 '15 at 19:52
• @Jake it sounds like a good idea indeed. – Mauren May 3 '15 at 19:52

Try a lower value for aspect. Here it is with value of 0.25. The closer it's to 1, the more like yours. If you tried 0.10 it would almost be a rectangular shape.

## Code

\documentclass{article}
\usepackage{tikz}

\usetikzlibrary{shapes,shapes.geometric}

\begin{document}
\begin{tikzpicture}[node distance=5cm]

\node (db1) [cylinder,
fill=blue!30,
shape border rotate=90,
draw,
minimum height=1.5cm,
minimum width=2cm,
shape aspect=.25,] {Some text};

\end{tikzpicture}
\end{document}

• Would you mind explaining how does aspect and shape aspect differ from one another? – Mauren May 3 '15 at 19:51
• @Mauren They don't. I just tested it with another shape and writing only aspect. – Alenanno May 3 '15 at 19:53
• @Mauren However I've always seen shape aspect being used. And if you check the Tikz Manual, page 221, the actual key is shape aspect. – Alenanno May 3 '15 at 19:57
• I probably got a bad example while looking around. – Mauren May 3 '15 at 19:57
• With minimum width the shape aspect depend from text in shape (try omit the text in node). The aspect is preserve if you define 'text width' instead of minimum width. – Zarko May 3 '15 at 21:03