Update: Now works with large numbers
Here's a macro (and accompanying pgfplots style) which draws a diagonal grid with a gradient of -1. It works regardless of the unit lengths of the plot and regardless of whether the axis limits are set explicitly or not. It will work with large numbers, but care must be taken to select an adequate diagonal grid spacing, as the \foreach loop cannot handle more than 45000 entries (then again, that many grid lines probably wouldn't make much sense).
What it does first is to determine the width and height of the plot in plot dimensions by querying the key /pgfplots/xmin, /pgfplots/xmax etc. This has to happen after all the plots have been defined, as otherwise the values could still change. That's why the macro uses \pgfplotsextra{}, which tells pgfplots to execute the code at the end of the so called "surveying phase', i.e. after everything has been defined, but before it has actually been drawn.
After the number of required grid lines have been determined from the width and height of the plot, a \foreach loop is executed which draws the lines. It uses the every axis grid style, so that you can influence the appearance of the diagonal grid lines in the same way as you would with normal grid lines.
To activate the diagonal grid in an axis, just use the key diagonal grid in the axis options.
Here's an example of the output:

And here's the implementation. The option execute at begin plot is only available in the development version of PGFPlots. For earlier versions, just call \diagonalgrid before the first plot. The spacing of the lines can be adjusted using the key diagonal grid spacing:
\documentclass{article}
\usepackage{pgfplots}
\newcommand{\diagonalgrid}{
\pgfplotsextra{
\pgfkeys{/pgf/fpu}
\pgfmathparse{\pgfkeysvalueof{/pgfplots/diagonal grid spacing}}
\let\spacing=\pgfmathresult
\pgfmathparse{\pgfkeysvalueof{/pgfplots/xmin}}
\let\xmin=\pgfmathresult
\pgfmathparse{\pgfkeysvalueof{/pgfplots/xmax}}
\let\xmax=\pgfmathresult
\pgfmathparse{\pgfkeysvalueof{/pgfplots/ymin}}
\let\ymin=\pgfmathresult
\pgfmathparse{\pgfkeysvalueof{/pgfplots/ymax}}
\let\ymax=\pgfmathresult
\pgfmathparse{round((\pgfkeysvalueof{/pgfplots/xmin}-\spacing)/\spacing)*\spacing}
\let\roundxmin=\pgfmathresult
\pgfmathfloattofixed{\pgfmathresult}
\let\fixedxmin=\pgfmathresult\fixedxmin
\pgfmathparse{round((\pgfkeysvalueof{/pgfplots/xmax}+\spacing)/\spacing)*\spacing}
\let\roundxmax=\pgfmathresult
\pgfmathparse{round((\pgfkeysvalueof{/pgfplots/ymin}-\spacing)/\spacing)*\spacing}
\let\roundymin=\pgfmathresult
\pgfmathfloattofixed{\pgfmathresult}
\let\fixedymin=\pgfmathresult
\pgfmathparse{round((\pgfkeysvalueof{/pgfplots/ymax}+\spacing)/\spacing)*\spacing}
\let\roundymax=\pgfmathresult
\pgfmathparse{(\roundxmax-\roundxmin + \roundymax-\roundymin)/\spacing}
\pgfmathfloattofixed{\pgfmathresult}
\let\totalnumber=\pgfmathresult
\foreach \n in {0,...,\totalnumber}{
\pgfmathparse{(\n * \spacing+ \roundxmin)}
\pgfmathfloattofixed{\pgfmathresult}
\let\currentxmin=\pgfmathresult
\pgfmathparse{(\n * \spacing+ \roundymin)}
\pgfmathfloattofixed{\pgfmathresult}
\let\currentymin=\pgfmathresult
\pgfkeys{/pgf/fpu=false}
\draw [/pgfplots/every axis grid] (axis cs:\fixedxmin,\currentymin) -- (axis cs:\currentxmin,\fixedymin);
}
}
}
\pgfkeys{/pgfplots/diagonal grid/.style={execute at begin axis={\diagonalgrid}}}
\pgfkeys{/pgfplots/diagonal grid spacing/.initial={1}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis equal,grid=both,diagonal grid,diagonal grid spacing=1000]
\addplot [domain={10000:15000}]{-0.2*x+50000};
\end{axis}
\end{tikzpicture}
\end{document}
ymintoymax)? And are all limits (xmin,xmax,ymin,ymax) manually set? – Jake May 14 '11 at 14:39axis equal=trueset, others (for whichaxis equal=truedid not work) have all limits set manually to ensure the same unit length for x and y. To give you an idea what I am trying to do here: The lines represent bands in which the sum of x and y is the same. – Jannik Jochem May 14 '11 at 14:57