11
$\begingroup$

I have a curve in parametric form:

ParametricPlot[{(1 - Cos[2 \[Pi] s]) Sin[2 \[Pi] s], 
  Cos[2 \[Pi] s] (Sin[2 \[Pi] s] + 1)}, {s, 0, 1}, Axes -> False, 
 PlotStyle -> Black]

This gives:

enter image description here

Is there a way to fill it with black?

$\endgroup$
17
$\begingroup$

You can post-process ParametricPlot output to change Line to FilledCurve:

ParametricPlot[{(1 - Cos[2 π s]) Sin[2 π s], 
   Cos[2 π s] (Sin[2 π s] + 1)}, {s, 0, 1}, Axes -> False, 
  PlotStyle -> Black] /. l_Line :> FilledCurve[l]

enter image description here

Use the replacement rule

l_Line :> {Opacity[1.], FilledCurve[l]}

to get

enter image description here

We get the same result if we use a rule that replaces Lines with Polygons:

Line[x_] :> {Opacity[1], Polygon[Append[x, First @ x]]}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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