# Pgfplots: how do I fill an area over a curve?

I'm working with pgfplots, and I have a curve on a graph which is basically a rect. I would like to color the part on top of it, not the part under it. I have this code:

\addplot[fill=\sixthplotcolor, fill opacity=0.5, thick, mark=none, color=\sixthplotcolor]
coordinates {
(1, 40)
(10, 400)
(100, 4000)
(150, 6000)
(200, 8000)
(250, 10000)
(300, 12000)
(350, 14000)
(500, 20000)
(750, 30000)
(1000, 40000)
} \closedcycle;


Which colors under the curve, but not over.

Can anyone help me? Sorry for the dumb question, I'm new to pgfplots.

-
For this specific example finish of your plot command with -- (axis cs:0,40000) \closedcycle; and it should fill the upper part. – percusse Jun 14 '12 at 15:32
@percusse: Or just -| (current plot begin);. – Jake Jun 14 '12 at 15:33
@Jake Ah, sure. Much better. – percusse Jun 14 '12 at 15:34
Well, thanks! What does -- (axis cs:0,40000) and -| (current plot begin); do exactly? – Madhatter Jun 14 '12 at 15:35
Welcome to TeX.SE. Good first question. For future reference, please keep in mind that while code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Jun 14 '12 at 19:24

As given in the comments, for this specific example using a predefined special coordinate and orthogonal lines can be used to achieve the goal.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
coordinates {
(1, 40)
(10, 400)
(100, 4000)
(150, 6000)
(200, 8000)
(250, 10000)
(300, 12000)
(350, 14000)
(500, 20000)
(750, 30000)
(1000, 40000)
} -| (current plot begin);
\end{axis}
\end{tikzpicture}
\end{document}


-