Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{patchplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot[patch,patch type=cubic spline]coordinates{(0,0)(3,1)(1,.5)(2,.5)};
\end{axis}
\end{tikzpicture}
\end{document}
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

1 Answer 1

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

 
discard

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.