\documentclass[a4paper]{article}

\usepackage{pgfplots}


\begin{document}
\begin{tikzpicture}
	\begin{axis}[colorbar,
		point meta min=0,point meta max=1
	]
	\addplot[mesh,domain=0:1] {x};
	\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{axis}[colorbar,point meta min=0,point meta max=1]
	\addplot[mesh,domain=0:1e4] {x};
	\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{axis}[colorbar,
		point meta min=0,point meta max=1
	]
	\addplot[mesh,domain=0:1e4] {1-x};
	\end{axis}
\end{tikzpicture}
\end{document}

