# How to fill the heart curve with solid red color? [duplicate]

The parametric equation of the heart curve is from this link

$$\left\{\quad \begin{array}{rcl} x&=&\cos {t} \cdot\sin {t} \cdot\ln \left| t\right| \\[10pt] y&=&\left| t\right| ^{0.3} \cdot\sqrt{\cos {t}} \\ \end{array} \right.\quad t\in[-1,1]$$

Below the code visualizes the curve:

ParametricPlot[{Sin@t Cos@t Log@Abs@t,(Abs@t)^.3 Sqrt[Cos@t]}(*u,{u,0,1}*),{t,-1,1},PlotRange->All,PlotStyle->Red,MeshFunctions->{#3&  },MeshStyle->None]


I also want to fill the closed curve with some solid color, for instance, red. The following code:

ParametricPlot[{Sin@t Cos@t Log@Abs@t,(Abs@t)^.3 Sqrt[Cos@t]}u,{u,0,1},{t,-1,1},PlotRange->All,PlotStyle->Red,MeshFunctions->{#3&  },MeshStyle->None]


gives:

Let $O(0,0)$ be the coordinate system's origin, and $P(x,y)$ a moving point on the curve. Then it seems when there is intersection points between the segment connecting $O(0,0)$ and $P(x,y)$ and the closed curve, then there will be filling problem (filling color overflow).

When I move the curve to let $O$ inside the curve exactly problem will be solved relatively easier...(though still a little weird if the PlotPoints is still the default number)

Code:

ParametricPlot[{ Sin@t Cos@t Log@Abs@t,(Abs@t)^.3  Sqrt[Cos@t]-.71}u,{u,0,1},{t,-1,1},PlotRange->All,PlotStyle->Directive[Opacity[0,Red],Red],MeshShading->{Red, Red},MeshFunctions->{#3&},Mesh->Automatic,MeshStyle->Red,PlotPoints->200,Axes->None,Frame->None]


gives:

which is closer to the target but has the following disadvantages:

1. It is too slow;
2. There are white noise;

I wonder only for such a parameric equation without any coordinate transform, how can i fill it will solid color /pattern with options in ParametricPlot? I understand by approximating the closed curve with a polygon, things will also be easier, the key is whether it is possible to handle it with ParametricPlot's MeshFunction related options?

## marked as duplicate by J. M. will be back soon♦Oct 6 '16 at 9:43

• I would say this is a dupe of this. For your specific case: ParametricPlot[{Sin@t Cos@t Log@Abs@t, (Abs@t)^.3 Sqrt[Cos@t]}, {t, -1, 1}, Axes -> None, Frame -> True, PlotRange -> All] /. Line[l_List] :> {Directive[EdgeForm[Opacity[1/2, Black]], Opacity[1, Red]], Polygon[l]} – J. M. will be back soon Jun 3 '16 at 7:36
• thank you! I am interested in how to realize it with the MeshFunctions option in ParametricPlot itself. – user6043040 Jun 3 '16 at 7:50

Try this:

lst = Table[{Sin@t Cos@t Log@Abs@t, (Abs@t)^.3 Sqrt[Cos@t]}, {t, -1,
1, 0.0001}];


and then

 ListLinePlot[lst, PlotStyle -> Red, PlotRange -> All,
Filling -> Bottom, FillingStyle -> Red]


yielding the following

Have fun!