Fixing ordering of nodes and color (TikZ)

This is my first time using TikZ. I can't figure out how to change the ordering of the nodes from bottom up starting from the bottom left corner?

Also, when I try to use package xcolor midnightblue doesn't work. Why is this? How can I get it to work?

\documentclass{minimal}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[darkstyle/.style={circle,draw,fill=midnightblue!25,minimum size=4}]
\foreach \x in {0,...,4}
\foreach \y in {0,...,4}
{\pgfmathtruncatemacro{\label}{\x - 5 *  \y +21}
\node [darkstyle]  (\x\y) at (1.5*\x,1.5*\y) {\label};}

\foreach \x in {0,...,4}
\foreach \y [count=\yi] in {0,...,3}
\draw (\x\y)--(\x\yi) (\y\x)--(\yi\x) ;

\end{tikzpicture}
\end{document}

-
Adding y=-1cm to the TikZ picture’s option would be one way. Or simply using \node [darkstyle] (\x\y) at (1.5*\x,-1.5*\y) {\label};} (note the -). — For future MWEs, please see Why not use the minimal class. – Qrrbrbirlbel Apr 5 '13 at 6:40
@Qrrbrbirlbel Man, this is really overwhelming... Does that mean it's not a good idea to use this code? – AlanH Apr 5 '13 at 6:46
Other advice: instead of \x\y (Ex: 00, ..., 44), use a-\x-\y (ex: a-0-0, ..., a-4-4) to name your nodes. – Paul Gaborit Apr 5 '13 at 6:48
While the minimal class works quite good for simple TikZ pictures, it is not a class for minimal WEs. Simply use article or the standalone class (which, setup correctly, can automatically produce .png files). The standalone class even has a tikz option which a) loads the tikz package automatically and b) crops the PDF so that you only have the picture. – Qrrbrbirlbel Apr 5 '13 at 6:50

You need to use -y for the placement coordinate if you want to start at the bottom and work up. Also the color is MidnightBlue and it requires the use of the [dvipsnames] option:

Code:

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[darkstyle/.style={circle,draw,fill=MidnightBlue!25,minimum size=4}]
\foreach \x in {0,...,4}
\foreach \y in {0,...,4}
{\pgfmathtruncatemacro{\label}{\x - 5 *  \y +21}
\node [darkstyle]  (\x\y) at (1.5*\x,-1.5*\y) {\label};}

\foreach \x in {0,...,4}
\foreach \y [count=\yi] in {0,...,3}
\draw (\x\y)--(\x\yi) (\y\x)--(\yi\x) ;

\end{tikzpicture}
\end{document}


If you desire the numbering to start at the bottom left and go up then you need to alter the computation of the \label:

Code:

\RequirePackage[dvipsnames]{xcolor}
\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[darkstyle/.style={circle,draw,fill=MidnightBlue!25,minimum size=4}]
\foreach \x in {0,...,4}
\foreach \y in {0,...,4}
{\pgfmathtruncatemacro{\label}{5*\x  + \y + 1}
\node [thick, darkstyle, minimum size=2.5em]  (\x\y) at (1.5*\x,1.5*\y) {\label};}

\foreach \x in {0,...,4}
\foreach \y [count=\yi] in {0,...,3}
\draw (\x\y)--(\x\yi) (\y\x)--(\yi\x) ;

\end{tikzpicture}
\end{document}

-
How do I get the node sizes to be uniform? – AlanH Apr 5 '13 at 6:42
To get uniform node sizes, you can either use something like minimum size=2.0em, or make each label the same size using a \makebox. – Peter Grill Apr 5 '13 at 6:46
Using \PassOptionsToPackage{dvipsnames}{xcolor} before the documentclass might save some headache for later. – percusse Apr 5 '13 at 6:49
@AlanH: Have updated the solution, but that is more of math issue rather than a TeX issue. – Peter Grill Apr 5 '13 at 7:22
@AlanH: Your welcome. Must be more difficult due to the extreme cold temperature of where you are. :-) – Peter Grill Apr 5 '13 at 7:24