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

This question already has an answer here:

Imagine I have a have a set of points that form a closed curve (or simply a circle), I normally just list plot these points and join the dots.

However, I now have the need to fill in this closed area. I could break it into two sets of curves and fill between the result, but let us pretend I have hundreds of these plots to make and want a quicker way.

share|improve this question
    
Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the FAQs! 3) When you see good Q&A, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. ALSO, remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign` –  Vitaliy Kaurov Feb 6 '13 at 16:33
add comment

marked as duplicate by Mr.Wizard Jan 10 at 10:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 11 down vote accepted

I recommend FilledCurve. Imagine you have a set of points:

pts = {{-1, 0}, {-1, 1}, {0, 0}, {1, 1}, {1, 0}};

Compare smooth curve:

Graphics[{Pink, Thick, BSplineCurve[pts, SplineClosed -> True]}]

enter image description here

To its filled version:

Graphics[{Pink, EdgeForm[Directive[Black, Thick]], 
  FilledCurve[BSplineCurve[pts, SplineClosed -> True]]}]

enter image description here

I guess you need a smooth curve, because for just joined points with a filling inside even Polygon will do - and you get a smooth one with enough points:

bsf = BSplineFunction[pts, SplineClosed -> True];
dat = Table[bsf[t], {t, 0, 1, .01}];
Graphics[{Pink, EdgeForm[Directive[Black, Thick]], Polygon[dat]}]

enter image description here

share|improve this answer
    
Great, thanks for this, now I just need to make it work well with Log plots... –  Jay Feb 7 '13 at 1:55
add comment

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