TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to fill the area under a spline? In the example below, removing mesh from the addplot options closes the cycle as expected with by joining the first and last coordinate by a straight line. How can the fill instead be to the axis?

\addplot[patch,patch type=cubic spline]coordinates{(0,0)(3,1)(1,.5)(2,.5)};
share|improve this question
I expanded your code to a full minimal working example (MWE) so that it is easier for others to work on a solution. – Benedikt Bauer Oct 15 '12 at 11:54

A valid request. It is currently unsupported by pgfplots (which assumes that mesh plots introduce individually colored segments for which fill-against-axis is no use-case).

I accept this as a feature request. More precisely, future versions of pgfplots will draw one global path with a single color as soon as point meta=none is used to disable individually colored segments. The future version will support fill-against-axis by appending fill=blue and the suffix (2,.5)} \closedcycle;

share|improve this answer
Thanks! Your work on pgfplots is very much appreciated. – mynoduesp Oct 29 '12 at 11:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.