5
$\begingroup$
{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?

$\endgroup$
10
$\begingroup$

Use

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.

$\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.