My version (below) of the "Valentine Formula" that appeared in today's New York Times, has some ugly artifacts that don't appear in the NYT (Java) version:

enter image description here

How do I remove these artifacts?

    ContourPlot3D[(x^2+((1+b)*y)^2+z^2-1)^3-x^2*z^3-a*y^2*z^3 ==0,

2 Answers 2


RegionPlot3D can sometimes give cleaner results out of the box. I also upped the PlotPoints manually.

 RegionPlot3D[(x^2 + ((1 + b)*y)^2 + z^2 - 1)^3 - x^2*z^3 - 
    a*y^2*z^3 <= 0, {x, -scale, scale}, {y, -scale, 
   scale}, {z, -scale, scale}, Mesh -> None, Axes -> None, 
  Boxed -> False, 
  PlotStyle -> Directive[Red, Opacity[0.8], Specularity[White, 30]], 
  PlotPoints -> ControlActive[Automatic, 40]], {{a, .1}, .0001, 
  1}, {{b, 1}, .00001, 5}, {{scale, 1.25}, 1, 5}, 
 SynchronousUpdating -> False]

  • $\begingroup$ That's much nicer! $\endgroup$
    – orome
    Feb 14, 2019 at 16:40

Adding the ContourPlot3D option PlotPoints -> n where n is some number greater than or equal to 100 improved things considerably for me. There is still a very faint ring around the lower portion of the heart when I do this, but it's a considerable improvement.

The PlotPoints argument tells Mathematica how many points to use when initially sampling the plot. Many functions (including 2D functions like DensityPlot) accept this argument. For whatever reason, the default is often quite low for functions/plots with rapid changes or singularities.


First, without any additional argument: enter image description here

Then with PlotPoints -> 200. with argument

  • $\begingroup$ That doesn't do anything for me. $\endgroup$
    – orome
    Feb 14, 2019 at 16:38
  • $\begingroup$ @orome I bet you place the option in the Directive again. $\endgroup$
    – xzczd
    Feb 14, 2019 at 16:39
  • $\begingroup$ @xzczd: Yep! (God I hate Mathematica's inadequate syntax checking!) $\endgroup$
    – orome
    Feb 14, 2019 at 16:42
  • $\begingroup$ @orome I'm also surprised that Mathematica doesn't give any warning in this case :D $\endgroup$
    – xzczd
    Feb 14, 2019 at 16:43
  • $\begingroup$ It shows improvement now, but still shows (as you point out) artifacts that ruin it. $\endgroup$
    – orome
    Feb 14, 2019 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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