[Tex/LaTex] How to the distance from a TikZ node to its label be changed

labelsnodestikz-pgf

I have a diagram of a few nodes and a few labels. I want the distance of each label from its respective node to be increased (to prevent it from overlapping with lines of the diagram). What is the correct syntax to do this?

\documentclass[tikz, border=10pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \draw[step=1cm] (0,0) grid (5,1);
    \node[label=above:\rotatebox{-45}{king} ] at (0.5,0.5) {0};
    \node[label=above:\rotatebox{-45}{queen}] at (1.5,0.5) {1};
    \node[label=above:\rotatebox{-45}{man}  ] at (2.5,0.5) {0};
    \node[label=above:\rotatebox{-45}{woman}] at (3.5,0.5) {0};
    \node[label=above:\rotatebox{-45}{child}] at (4.5,0.5) {0};
\end{tikzpicture}
\end{document}

Best Answer

Setting label distance I think.

\documentclass[tikz, border=10pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[label distance=5mm]
    \draw[step=1cm] (0,0) grid (5,1);
    \node[label=above:\rotatebox{-45}{king} ] at (0.5,0.5) {0};
    \node[label={[label distance=1cm]above:\rotatebox{-45}{queen}}] at (1.5,0.5) {1};
    \node[label=above:\rotatebox{-45}{man}  ] at (2.5,0.5) {0};
    \node[label=above:\rotatebox{-45}{woman}] at (3.5,0.5) {0};
    \node[label=above:\rotatebox{-45}{child}] at (4.5,0.5) {0};
\end{tikzpicture}
\end{document}

enter image description here