Iam making a quite simple draing in Tikz. I have found that I can set the with of my nodes using text width but text height doesn't work as well. Consider this example:



    \begin{tikzpicture}[node distance = 1.25cm, text width=2.5cm, text height=0.25cm,
                        rectangle, draw, text centered, ]
    \node (dataset) [rectangle, draw]{Dataset};
    \node (trainingset) [rectangle, draw, below left of=dataset, node distance = 2.5 cm]{Training set};
    \node (testset) [rectangle, draw, below right of=dataset, node distance = 2.5 cm]{Test set};

enter image description here

The Test set box is smaller than the Training set box. Why? And how can I make them the same size?

1 Answer 1


This happens because of the g of Training. It has a depth, and given that you do not fix the box depth, that box will result bigger than the box with Text set, which has no descendant.

You can fix the depth too, adding (for exaple) text depth=0.1cm to obtain:

enter image description here

You must log in to answer this question.

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