From: michuco on
Hi,

I am having problem converting something that I used
to be able to do in earlier versions of Mathematica (<6.0).

I would like to plot a wired-only 3d plot of a function,
say

f[x_,y_,z] := (x - 0.5) Exp[-0.5 ({x, y, z} - {0.5, 1., 1.}).
({x, y, z} - {0.5, 1., 1.})];

At the moment, when I want the equivalue contourplot
of this function at {-0.1,01} value, I use

ContourPlot3D[f[x, y, z], {x, -5, 5}, {y, -5, 5}, {z, -5, 5},
Contours -> {-0.1, 0.1}, PlotRange -> All,
ContourStyle -> {Opacity[0.]},
MeshStyle -> {{Red, Opacity[0.1]}, {Blue, Opacity[0.1]}}]


There are two problems with this. Firstly, the rotation is
much slower than I imagined it would be. I think that the
option ContourStyle -> {Opacity[0.]} means that the
surface is still part of the graphics. Secondly, I couldn't
get the mesh to be in different colors,.i.e., the negative
contour in blue and the positive in red, or one in dotted
mesh, the other in continuous mesh.

Right now, I plot the negative and positive parts separately
then combine them with Show. There must be a more
elegant way to do this. (In earlier versions, I used Shading
= False).

Finally, a general problem that I have with ContourPlot3D.
Sometimes, parts of the isovalue surface is missing. I
assume that they fall between the grid points because
I usually get rid of them by increasing PlotPoints, this
is both time consuming and tedious. Is there a better
option?

Many thanks in advance,

Michuco

From: Patrick Scheibe on
Hi,

for your first question there's a fast answer: Use None instead
of smth with Opacity

ContourPlot3D[f[x, y, z], {x, -5, 5}, {y, -5, 5}, {z, -5, 5},
Contours -> {-0.1, 0.1}, PlotRange -> All, ContourStyle -> None,
MeshStyle -> {{Red, Opacity[0.1]}, {Blue, Opacity[0.1]}}]

is incredible fast compared to your version.

For your second question, right now I don't see a faster way than you
suggested.

For your third question I would suggest that you check out the
MaxRecursion option. To let Mathematica subdivide regions with
complex structures is very often better than just increase the plot-
points.

Plot[Sin[x^2], {x, 0, 2 Pi}, PlotPoints -> 5, MaxRecursion -> #,
Mesh -> All] & /@ {3, 10}

Cheers
Patrick

Am Jun 1, 2010 um 10:23 AM schrieb michuco:

> Hi,
>
> I am having problem converting something that I used
> to be able to do in earlier versions of Mathematica (<6.0).
>
> I would like to plot a wired-only 3d plot of a function,
> say
>
> f[x_,y_,z] := (x - 0.5) Exp[-0.5 ({x, y, z} - {0.5, 1., 1.}).
> ({x, y, z} - {0.5, 1., 1.})];
>
> At the moment, when I want the equivalue contourplot
> of this function at {-0.1,01} value, I use
>
> ContourPlot3D[f[x, y, z], {x, -5, 5}, {y, -5, 5}, {z, -5, 5},
> Contours -> {-0.1, 0.1}, PlotRange -> All,
> ContourStyle -> {Opacity[0.]},
> MeshStyle -> {{Red, Opacity[0.1]}, {Blue, Opacity[0.1]}}]
>
>
> There are two problems with this. Firstly, the rotation is
> much slower than I imagined it would be. I think that the
> option ContourStyle -> {Opacity[0.]} means that the
> surface is still part of the graphics. Secondly, I couldn't
> get the mesh to be in different colors,.i.e., the negative
> contour in blue and the positive in red, or one in dotted
> mesh, the other in continuous mesh.
>
> Right now, I plot the negative and positive parts separately
> then combine them with Show. There must be a more
> elegant way to do this. (In earlier versions, I used Shading
> = False).
>
> Finally, a general problem that I have with ContourPlot3D.
> Sometimes, parts of the isovalue surface is missing. I
> assume that they fall between the grid points because
> I usually get rid of them by increasing PlotPoints, this
> is both time consuming and tedious. Is there a better
> option?
>
> Many thanks in advance,
>
> Michuco
>


From: michuco on
On Jun 1, 6:41 am, Patrick Scheibe <psche...(a)trm.uni-leipzig.de>
wrote:
> Hi,
>
> for your first question there's a fast answer: Use None instead
> of smth with Opacity
>
> ContourPlot3D[f[x, y, z], {x, -5, 5}, {y, -5, 5}, {z, -5, 5},
> Contours -> {-0.1, 0.1}, PlotRange -> All, ContourStyle -> None,
> MeshStyle -> {{Red, Opacity[0.1]}, {Blue, Opacity[0.1]}}]
>
> is incredible fast compared to your version.
>
> For your second question, right now I don't see a faster way than you
> suggested.
>
> For your third question I would suggest that you check out the
> MaxRecursion option. To let Mathematica subdivide regions with
> complex structures is very often better than just increase the plot-
> points.
>
> Plot[Sin[x^2], {x, 0, 2 Pi}, PlotPoints -> 5, MaxRecursion -> #,
> Mesh -> All] & /@ {3, 10}
>
> Cheers
> Patrick
>
> Am Jun 1, 2010 um 10:23 AM schrieb michuco:
>
> > Hi,
>
> > I am having problem converting something that I used
> > to be able to do in earlier versions of Mathematica (<6.0).
>
> > I would like to plot a wired-only 3d plot of a function,
> > say
>
> > f[x_,y_,z] := (x - 0.5) Exp[-0.5 ({x, y, z} - {0.5, 1., 1.}).
> > ({x, y, z} - {0.5, 1., 1.})];
>
> > At the moment, when I want the equivalue contourplot
> > of this function at {-0.1,01} value, I use
>
> > ContourPlot3D[f[x, y, z], {x, -5, 5}, {y, -5, 5}, {z, -5, 5},
> > Contours -> {-0.1, 0.1}, PlotRange -> All,
> > ContourStyle -> {Opacity[0.]},
> > MeshStyle -> {{Red, Opacity[0.1]}, {Blue, Opacity[0.1]}}]
>
> > There are two problems with this. Firstly, the rotation is
> > much slower than I imagined it would be. I think that the
> > option ContourStyle -> {Opacity[0.]} means that the
> > surface is still part of the graphics. Secondly, I couldn't
> > get the mesh to be in different colors,.i.e., the negative
> > contour in blue and the positive in red, or one in dotted
> > mesh, the other in continuous mesh.
>
> > Right now, I plot the negative and positive parts separately
> > then combine them with Show. There must be a more
> > elegant way to do this. (In earlier versions, I used Shading
> > = False).
>
> > Finally, a general problem that I have with ContourPlot3D.
> > Sometimes, parts of the isovalue surface is missing. I
> > assume that they fall between the grid points because
> > I usually get rid of them by increasing PlotPoints, this
> > is both time consuming and tedious. Is there a better
> > option?
>
> > Many thanks in advance,
>
> > Michuco

Patrick,

Many thanks for the tips. "ContourStyle=None" was
right on! However, I couldn't quite figure out MaxRecursion.
At low value < 5, there still were holes on the surface, and
at 6 the kernel crashes. At this point, I would be more
than happy if I can just tell ContourPlot3D not to draw the
missing pieces in black!

Regards,

Michuco