Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
{m0, m1, m2, m3, m4, m5, m6, m7} = {4, 3, 2, 3, 6, 2, 6, 4};
r = Sin[m0*phi]^m1 + Cos[m2*phi]^m3 + Sin[m4*theta]^m5 + Cos[m6*theta]^m7;
g = ParametricPlot3D[{r*Sin[phi]*Cos[theta], r*Cos[phi], 
    r*Sin[phi]*Sin[theta]}, {phi, 0, Pi}, {theta, 0, 2 Pi}, 
   ColorFunction -> (Blend[{Red, Yellow, Green, Cyan, Blue}, #] &), 
   Mesh -> None, Boxed -> False, Axes -> 0];
g /. Polygon -> Line

gives this:

enter image description here

The colour information is gone.

I want to get the output below:

enter image description here

How can I get it?

share|improve this question
How did you get the second graphic? – Szabolcs Mar 10 '13 at 17:38
@Szabolcs, I get the second graphics from python's lib enthought.mayavi. – chyaong Mar 10 '13 at 17:43
up vote 10 down vote accepted


Normal[g] /. Polygon -> Line

Mathematica graphics

Polygon colours are usually specified using the VertexColors option. This works both in Polygon and in Line, so the colour should be preserved when you do a simple replace operation. But ParametricPlot3D will produce a GraphicsComplex and will place the VertexColor option inside GraphicsComplex instead of Polygon.

Normal will simply get rid of the GraphicsComplex.

share|improve this answer

Your Answer


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.