Onion plot of a ball
$begingroup$
Consider the following simple example.
RegionPlot3D[x^2 + y^2 + z^2 <= 1, {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
MeshFunctions -> (Sqrt[#1^2 + #2^2 + #3^2] &),
Mesh -> {{0.25, .5, .75}}, PlotStyle -> Opacity[.5], Axes -> False]

I would like to show some of the surfaces described by the mesh function which lie inside the ball. Is it possible to visualize only these surfaces?
plotting regions meshfunction
$endgroup$
add a comment |
$begingroup$
Consider the following simple example.
RegionPlot3D[x^2 + y^2 + z^2 <= 1, {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
MeshFunctions -> (Sqrt[#1^2 + #2^2 + #3^2] &),
Mesh -> {{0.25, .5, .75}}, PlotStyle -> Opacity[.5], Axes -> False]

I would like to show some of the surfaces described by the mesh function which lie inside the ball. Is it possible to visualize only these surfaces?
plotting regions meshfunction
$endgroup$
add a comment |
$begingroup$
Consider the following simple example.
RegionPlot3D[x^2 + y^2 + z^2 <= 1, {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
MeshFunctions -> (Sqrt[#1^2 + #2^2 + #3^2] &),
Mesh -> {{0.25, .5, .75}}, PlotStyle -> Opacity[.5], Axes -> False]

I would like to show some of the surfaces described by the mesh function which lie inside the ball. Is it possible to visualize only these surfaces?
plotting regions meshfunction
$endgroup$
Consider the following simple example.
RegionPlot3D[x^2 + y^2 + z^2 <= 1, {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
MeshFunctions -> (Sqrt[#1^2 + #2^2 + #3^2] &),
Mesh -> {{0.25, .5, .75}}, PlotStyle -> Opacity[.5], Axes -> False]

I would like to show some of the surfaces described by the mesh function which lie inside the ball. Is it possible to visualize only these surfaces?
plotting regions meshfunction
plotting regions meshfunction
edited Feb 15 at 10:33
m_goldberg
87.6k872198
87.6k872198
asked Feb 15 at 9:12
Ulrich NeumannUlrich Neumann
9,548617
9,548617
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
Update: Post-process RegionPlot outputs to remove the walls:
colors = ColorData[97] /@ Range[4];
radii = {1, 3/4, 1/2, 1/4};
regionplots = RegionPlot3D[x^2 + y^2 + z^2 <= #^2, {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
Mesh -> None, BoundaryStyle -> None, Axes -> False] & /@ radii;
Graphics3D[{EdgeForm, FaceForm[{Opacity[.5], #[[2]]}],
Cases[Normal[#[[1]]][[1]], _GraphicsGroup, All][[1]]}&/@Transpose[{regionplots, colors}],
Boxed -> False]

Alternatively, delete the Polygons with constant VertexNormals:
Show[DeleteCases[Normal@RegionPlot3D[x^2 + y^2 + z^2 <= #^2,
{x, 0, 1}, {y, 0, 1}, {z, 0, 1},
BoundaryStyle -> None, Mesh -> None, BaseStyle -> Opacity[.5],
PlotStyle -> #2, Axes -> False],
Polygon[_, VertexNormals -> {{a_, b_, c_} ..}], All] & @@@
Transpose[{radii, colors}], Boxed -> False]

Original answer:
You can use a combination of ImplicitRegion and DiscretizeRegion as follows:
ir[r_] := ImplicitRegion[x^2 + y^2 + z^2 == r^2, {{x, 0, 1}, {y, 0, 1}, {z, 0, 1}}]
radii = {1, 3/4, 1/2, 1/4};
colors = ColorData[97] /@ Range[4];
boundaries = RegionPlot3D[x^2 + y^2 + z^2 <= 1.1,
{x, 0, 1}, {y, 0, 1}, {z, 0, 1},
MeshFunctions -> (Sqrt[#1^2 + #2^2 + #3^2] &),
Mesh -> {Transpose[{radii, colors}]}, MeshStyle -> Thick,
PlotStyle -> Opacity[0], Axes -> False, BoundaryStyle -> None];
i = 1;
surfaces = DiscretizeRegion[ir[#],
MeshCellStyle -> {{2, All} -> Opacity[0.5, colors[[i++]]]}] & /@ radii;
Legended[Show[surfaces, boundaries],
SwatchLegend[colors, "radius = " <> ToString[#, StandardForm] & /@ radii]]

$endgroup$
$begingroup$
Thank you very much for your effort. In my concrete problem I only can build on (don't know whyContourPlotandImplicitRegiondon't evaluate) the result ofRegionPlot3Dto find the shells.
$endgroup$
– Ulrich Neumann
Feb 16 at 9:12
$begingroup$
@UlrichNeumann, does the approach in the update work in your problem?
$endgroup$
– kglr
Feb 16 at 10:28
$begingroup$
Yes , thanks for the two solution ideas!
$endgroup$
– Ulrich Neumann
Feb 16 at 10:37
add a comment |
$begingroup$
Like this?
ContourPlot3D[x^2 + y^2 + z^2, {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
ContourStyle -> Directive[Opacity[.5], ColorData[97][1]],
Axes -> False,
Contours -> {0.25, .5, .75},
Mesh -> None
]

$endgroup$
$begingroup$
Yes like this, thanks. But in my underlying problem I need to use the RegionPlot3D, because ContourPlot3D cannot evaluate.
$endgroup$
– Ulrich Neumann
Feb 15 at 9:27
$begingroup$
Huh? You have to explain that to me...
$endgroup$
– Henrik Schumacher
Feb 15 at 9:28
1
$begingroup$
Have you tried tweaking thePlotPointsandMaxRecursionoptions of yourContourPlot3D? Often when MMA takes a long time to produce a plot, it's simply obsessing over detail you're not really interested in and it pays to reduce the values for these options.
$endgroup$
– Sjoerd Smit
Feb 15 at 10:36
2
$begingroup$
TryingMaxRecursion -> 0andPlotPoints -> 25is always a good start. The result will look very blocky, but the number of function evaluations should be low.
$endgroup$
– Sjoerd Smit
Feb 15 at 12:45
1
$begingroup$
@UlrichNeumann The default forMaxRecursionis2, and time complexity, where significant refinement is called for, can grow exponentially. E.g.Table[First@ AbsoluteTiming[ ContourPlot3D[ x^2 + Sin[6 y] + z^2 == 1, {x, -1.1, 1.1}, {y, -1.1, 1.1}, {z, -1.1, 1.1}, MaxRecursion -> r]], {r, 0, 4}]-->{0.096103, 1.23869, 4.76033, 20.5314, 118.243}
$endgroup$
– Michael E2
Feb 15 at 13:37
|
show 2 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "387"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f191618%2fonion-plot-of-a-ball%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Update: Post-process RegionPlot outputs to remove the walls:
colors = ColorData[97] /@ Range[4];
radii = {1, 3/4, 1/2, 1/4};
regionplots = RegionPlot3D[x^2 + y^2 + z^2 <= #^2, {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
Mesh -> None, BoundaryStyle -> None, Axes -> False] & /@ radii;
Graphics3D[{EdgeForm, FaceForm[{Opacity[.5], #[[2]]}],
Cases[Normal[#[[1]]][[1]], _GraphicsGroup, All][[1]]}&/@Transpose[{regionplots, colors}],
Boxed -> False]

Alternatively, delete the Polygons with constant VertexNormals:
Show[DeleteCases[Normal@RegionPlot3D[x^2 + y^2 + z^2 <= #^2,
{x, 0, 1}, {y, 0, 1}, {z, 0, 1},
BoundaryStyle -> None, Mesh -> None, BaseStyle -> Opacity[.5],
PlotStyle -> #2, Axes -> False],
Polygon[_, VertexNormals -> {{a_, b_, c_} ..}], All] & @@@
Transpose[{radii, colors}], Boxed -> False]

Original answer:
You can use a combination of ImplicitRegion and DiscretizeRegion as follows:
ir[r_] := ImplicitRegion[x^2 + y^2 + z^2 == r^2, {{x, 0, 1}, {y, 0, 1}, {z, 0, 1}}]
radii = {1, 3/4, 1/2, 1/4};
colors = ColorData[97] /@ Range[4];
boundaries = RegionPlot3D[x^2 + y^2 + z^2 <= 1.1,
{x, 0, 1}, {y, 0, 1}, {z, 0, 1},
MeshFunctions -> (Sqrt[#1^2 + #2^2 + #3^2] &),
Mesh -> {Transpose[{radii, colors}]}, MeshStyle -> Thick,
PlotStyle -> Opacity[0], Axes -> False, BoundaryStyle -> None];
i = 1;
surfaces = DiscretizeRegion[ir[#],
MeshCellStyle -> {{2, All} -> Opacity[0.5, colors[[i++]]]}] & /@ radii;
Legended[Show[surfaces, boundaries],
SwatchLegend[colors, "radius = " <> ToString[#, StandardForm] & /@ radii]]

$endgroup$
$begingroup$
Thank you very much for your effort. In my concrete problem I only can build on (don't know whyContourPlotandImplicitRegiondon't evaluate) the result ofRegionPlot3Dto find the shells.
$endgroup$
– Ulrich Neumann
Feb 16 at 9:12
$begingroup$
@UlrichNeumann, does the approach in the update work in your problem?
$endgroup$
– kglr
Feb 16 at 10:28
$begingroup$
Yes , thanks for the two solution ideas!
$endgroup$
– Ulrich Neumann
Feb 16 at 10:37
add a comment |
$begingroup$
Update: Post-process RegionPlot outputs to remove the walls:
colors = ColorData[97] /@ Range[4];
radii = {1, 3/4, 1/2, 1/4};
regionplots = RegionPlot3D[x^2 + y^2 + z^2 <= #^2, {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
Mesh -> None, BoundaryStyle -> None, Axes -> False] & /@ radii;
Graphics3D[{EdgeForm, FaceForm[{Opacity[.5], #[[2]]}],
Cases[Normal[#[[1]]][[1]], _GraphicsGroup, All][[1]]}&/@Transpose[{regionplots, colors}],
Boxed -> False]

Alternatively, delete the Polygons with constant VertexNormals:
Show[DeleteCases[Normal@RegionPlot3D[x^2 + y^2 + z^2 <= #^2,
{x, 0, 1}, {y, 0, 1}, {z, 0, 1},
BoundaryStyle -> None, Mesh -> None, BaseStyle -> Opacity[.5],
PlotStyle -> #2, Axes -> False],
Polygon[_, VertexNormals -> {{a_, b_, c_} ..}], All] & @@@
Transpose[{radii, colors}], Boxed -> False]

Original answer:
You can use a combination of ImplicitRegion and DiscretizeRegion as follows:
ir[r_] := ImplicitRegion[x^2 + y^2 + z^2 == r^2, {{x, 0, 1}, {y, 0, 1}, {z, 0, 1}}]
radii = {1, 3/4, 1/2, 1/4};
colors = ColorData[97] /@ Range[4];
boundaries = RegionPlot3D[x^2 + y^2 + z^2 <= 1.1,
{x, 0, 1}, {y, 0, 1}, {z, 0, 1},
MeshFunctions -> (Sqrt[#1^2 + #2^2 + #3^2] &),
Mesh -> {Transpose[{radii, colors}]}, MeshStyle -> Thick,
PlotStyle -> Opacity[0], Axes -> False, BoundaryStyle -> None];
i = 1;
surfaces = DiscretizeRegion[ir[#],
MeshCellStyle -> {{2, All} -> Opacity[0.5, colors[[i++]]]}] & /@ radii;
Legended[Show[surfaces, boundaries],
SwatchLegend[colors, "radius = " <> ToString[#, StandardForm] & /@ radii]]

$endgroup$
$begingroup$
Thank you very much for your effort. In my concrete problem I only can build on (don't know whyContourPlotandImplicitRegiondon't evaluate) the result ofRegionPlot3Dto find the shells.
$endgroup$
– Ulrich Neumann
Feb 16 at 9:12
$begingroup$
@UlrichNeumann, does the approach in the update work in your problem?
$endgroup$
– kglr
Feb 16 at 10:28
$begingroup$
Yes , thanks for the two solution ideas!
$endgroup$
– Ulrich Neumann
Feb 16 at 10:37
add a comment |
$begingroup$
Update: Post-process RegionPlot outputs to remove the walls:
colors = ColorData[97] /@ Range[4];
radii = {1, 3/4, 1/2, 1/4};
regionplots = RegionPlot3D[x^2 + y^2 + z^2 <= #^2, {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
Mesh -> None, BoundaryStyle -> None, Axes -> False] & /@ radii;
Graphics3D[{EdgeForm, FaceForm[{Opacity[.5], #[[2]]}],
Cases[Normal[#[[1]]][[1]], _GraphicsGroup, All][[1]]}&/@Transpose[{regionplots, colors}],
Boxed -> False]

Alternatively, delete the Polygons with constant VertexNormals:
Show[DeleteCases[Normal@RegionPlot3D[x^2 + y^2 + z^2 <= #^2,
{x, 0, 1}, {y, 0, 1}, {z, 0, 1},
BoundaryStyle -> None, Mesh -> None, BaseStyle -> Opacity[.5],
PlotStyle -> #2, Axes -> False],
Polygon[_, VertexNormals -> {{a_, b_, c_} ..}], All] & @@@
Transpose[{radii, colors}], Boxed -> False]

Original answer:
You can use a combination of ImplicitRegion and DiscretizeRegion as follows:
ir[r_] := ImplicitRegion[x^2 + y^2 + z^2 == r^2, {{x, 0, 1}, {y, 0, 1}, {z, 0, 1}}]
radii = {1, 3/4, 1/2, 1/4};
colors = ColorData[97] /@ Range[4];
boundaries = RegionPlot3D[x^2 + y^2 + z^2 <= 1.1,
{x, 0, 1}, {y, 0, 1}, {z, 0, 1},
MeshFunctions -> (Sqrt[#1^2 + #2^2 + #3^2] &),
Mesh -> {Transpose[{radii, colors}]}, MeshStyle -> Thick,
PlotStyle -> Opacity[0], Axes -> False, BoundaryStyle -> None];
i = 1;
surfaces = DiscretizeRegion[ir[#],
MeshCellStyle -> {{2, All} -> Opacity[0.5, colors[[i++]]]}] & /@ radii;
Legended[Show[surfaces, boundaries],
SwatchLegend[colors, "radius = " <> ToString[#, StandardForm] & /@ radii]]

$endgroup$
Update: Post-process RegionPlot outputs to remove the walls:
colors = ColorData[97] /@ Range[4];
radii = {1, 3/4, 1/2, 1/4};
regionplots = RegionPlot3D[x^2 + y^2 + z^2 <= #^2, {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
Mesh -> None, BoundaryStyle -> None, Axes -> False] & /@ radii;
Graphics3D[{EdgeForm, FaceForm[{Opacity[.5], #[[2]]}],
Cases[Normal[#[[1]]][[1]], _GraphicsGroup, All][[1]]}&/@Transpose[{regionplots, colors}],
Boxed -> False]

Alternatively, delete the Polygons with constant VertexNormals:
Show[DeleteCases[Normal@RegionPlot3D[x^2 + y^2 + z^2 <= #^2,
{x, 0, 1}, {y, 0, 1}, {z, 0, 1},
BoundaryStyle -> None, Mesh -> None, BaseStyle -> Opacity[.5],
PlotStyle -> #2, Axes -> False],
Polygon[_, VertexNormals -> {{a_, b_, c_} ..}], All] & @@@
Transpose[{radii, colors}], Boxed -> False]

Original answer:
You can use a combination of ImplicitRegion and DiscretizeRegion as follows:
ir[r_] := ImplicitRegion[x^2 + y^2 + z^2 == r^2, {{x, 0, 1}, {y, 0, 1}, {z, 0, 1}}]
radii = {1, 3/4, 1/2, 1/4};
colors = ColorData[97] /@ Range[4];
boundaries = RegionPlot3D[x^2 + y^2 + z^2 <= 1.1,
{x, 0, 1}, {y, 0, 1}, {z, 0, 1},
MeshFunctions -> (Sqrt[#1^2 + #2^2 + #3^2] &),
Mesh -> {Transpose[{radii, colors}]}, MeshStyle -> Thick,
PlotStyle -> Opacity[0], Axes -> False, BoundaryStyle -> None];
i = 1;
surfaces = DiscretizeRegion[ir[#],
MeshCellStyle -> {{2, All} -> Opacity[0.5, colors[[i++]]]}] & /@ radii;
Legended[Show[surfaces, boundaries],
SwatchLegend[colors, "radius = " <> ToString[#, StandardForm] & /@ radii]]

edited Feb 16 at 12:57
answered Feb 15 at 22:41
kglrkglr
189k10206424
189k10206424
$begingroup$
Thank you very much for your effort. In my concrete problem I only can build on (don't know whyContourPlotandImplicitRegiondon't evaluate) the result ofRegionPlot3Dto find the shells.
$endgroup$
– Ulrich Neumann
Feb 16 at 9:12
$begingroup$
@UlrichNeumann, does the approach in the update work in your problem?
$endgroup$
– kglr
Feb 16 at 10:28
$begingroup$
Yes , thanks for the two solution ideas!
$endgroup$
– Ulrich Neumann
Feb 16 at 10:37
add a comment |
$begingroup$
Thank you very much for your effort. In my concrete problem I only can build on (don't know whyContourPlotandImplicitRegiondon't evaluate) the result ofRegionPlot3Dto find the shells.
$endgroup$
– Ulrich Neumann
Feb 16 at 9:12
$begingroup$
@UlrichNeumann, does the approach in the update work in your problem?
$endgroup$
– kglr
Feb 16 at 10:28
$begingroup$
Yes , thanks for the two solution ideas!
$endgroup$
– Ulrich Neumann
Feb 16 at 10:37
$begingroup$
Thank you very much for your effort. In my concrete problem I only can build on (don't know why
ContourPlot and ImplicitRegion don't evaluate) the result of RegionPlot3D to find the shells.$endgroup$
– Ulrich Neumann
Feb 16 at 9:12
$begingroup$
Thank you very much for your effort. In my concrete problem I only can build on (don't know why
ContourPlot and ImplicitRegion don't evaluate) the result of RegionPlot3D to find the shells.$endgroup$
– Ulrich Neumann
Feb 16 at 9:12
$begingroup$
@UlrichNeumann, does the approach in the update work in your problem?
$endgroup$
– kglr
Feb 16 at 10:28
$begingroup$
@UlrichNeumann, does the approach in the update work in your problem?
$endgroup$
– kglr
Feb 16 at 10:28
$begingroup$
Yes , thanks for the two solution ideas!
$endgroup$
– Ulrich Neumann
Feb 16 at 10:37
$begingroup$
Yes , thanks for the two solution ideas!
$endgroup$
– Ulrich Neumann
Feb 16 at 10:37
add a comment |
$begingroup$
Like this?
ContourPlot3D[x^2 + y^2 + z^2, {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
ContourStyle -> Directive[Opacity[.5], ColorData[97][1]],
Axes -> False,
Contours -> {0.25, .5, .75},
Mesh -> None
]

$endgroup$
$begingroup$
Yes like this, thanks. But in my underlying problem I need to use the RegionPlot3D, because ContourPlot3D cannot evaluate.
$endgroup$
– Ulrich Neumann
Feb 15 at 9:27
$begingroup$
Huh? You have to explain that to me...
$endgroup$
– Henrik Schumacher
Feb 15 at 9:28
1
$begingroup$
Have you tried tweaking thePlotPointsandMaxRecursionoptions of yourContourPlot3D? Often when MMA takes a long time to produce a plot, it's simply obsessing over detail you're not really interested in and it pays to reduce the values for these options.
$endgroup$
– Sjoerd Smit
Feb 15 at 10:36
2
$begingroup$
TryingMaxRecursion -> 0andPlotPoints -> 25is always a good start. The result will look very blocky, but the number of function evaluations should be low.
$endgroup$
– Sjoerd Smit
Feb 15 at 12:45
1
$begingroup$
@UlrichNeumann The default forMaxRecursionis2, and time complexity, where significant refinement is called for, can grow exponentially. E.g.Table[First@ AbsoluteTiming[ ContourPlot3D[ x^2 + Sin[6 y] + z^2 == 1, {x, -1.1, 1.1}, {y, -1.1, 1.1}, {z, -1.1, 1.1}, MaxRecursion -> r]], {r, 0, 4}]-->{0.096103, 1.23869, 4.76033, 20.5314, 118.243}
$endgroup$
– Michael E2
Feb 15 at 13:37
|
show 2 more comments
$begingroup$
Like this?
ContourPlot3D[x^2 + y^2 + z^2, {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
ContourStyle -> Directive[Opacity[.5], ColorData[97][1]],
Axes -> False,
Contours -> {0.25, .5, .75},
Mesh -> None
]

$endgroup$
$begingroup$
Yes like this, thanks. But in my underlying problem I need to use the RegionPlot3D, because ContourPlot3D cannot evaluate.
$endgroup$
– Ulrich Neumann
Feb 15 at 9:27
$begingroup$
Huh? You have to explain that to me...
$endgroup$
– Henrik Schumacher
Feb 15 at 9:28
1
$begingroup$
Have you tried tweaking thePlotPointsandMaxRecursionoptions of yourContourPlot3D? Often when MMA takes a long time to produce a plot, it's simply obsessing over detail you're not really interested in and it pays to reduce the values for these options.
$endgroup$
– Sjoerd Smit
Feb 15 at 10:36
2
$begingroup$
TryingMaxRecursion -> 0andPlotPoints -> 25is always a good start. The result will look very blocky, but the number of function evaluations should be low.
$endgroup$
– Sjoerd Smit
Feb 15 at 12:45
1
$begingroup$
@UlrichNeumann The default forMaxRecursionis2, and time complexity, where significant refinement is called for, can grow exponentially. E.g.Table[First@ AbsoluteTiming[ ContourPlot3D[ x^2 + Sin[6 y] + z^2 == 1, {x, -1.1, 1.1}, {y, -1.1, 1.1}, {z, -1.1, 1.1}, MaxRecursion -> r]], {r, 0, 4}]-->{0.096103, 1.23869, 4.76033, 20.5314, 118.243}
$endgroup$
– Michael E2
Feb 15 at 13:37
|
show 2 more comments
$begingroup$
Like this?
ContourPlot3D[x^2 + y^2 + z^2, {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
ContourStyle -> Directive[Opacity[.5], ColorData[97][1]],
Axes -> False,
Contours -> {0.25, .5, .75},
Mesh -> None
]

$endgroup$
Like this?
ContourPlot3D[x^2 + y^2 + z^2, {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
ContourStyle -> Directive[Opacity[.5], ColorData[97][1]],
Axes -> False,
Contours -> {0.25, .5, .75},
Mesh -> None
]

answered Feb 15 at 9:23
Henrik SchumacherHenrik Schumacher
56.8k577157
56.8k577157
$begingroup$
Yes like this, thanks. But in my underlying problem I need to use the RegionPlot3D, because ContourPlot3D cannot evaluate.
$endgroup$
– Ulrich Neumann
Feb 15 at 9:27
$begingroup$
Huh? You have to explain that to me...
$endgroup$
– Henrik Schumacher
Feb 15 at 9:28
1
$begingroup$
Have you tried tweaking thePlotPointsandMaxRecursionoptions of yourContourPlot3D? Often when MMA takes a long time to produce a plot, it's simply obsessing over detail you're not really interested in and it pays to reduce the values for these options.
$endgroup$
– Sjoerd Smit
Feb 15 at 10:36
2
$begingroup$
TryingMaxRecursion -> 0andPlotPoints -> 25is always a good start. The result will look very blocky, but the number of function evaluations should be low.
$endgroup$
– Sjoerd Smit
Feb 15 at 12:45
1
$begingroup$
@UlrichNeumann The default forMaxRecursionis2, and time complexity, where significant refinement is called for, can grow exponentially. E.g.Table[First@ AbsoluteTiming[ ContourPlot3D[ x^2 + Sin[6 y] + z^2 == 1, {x, -1.1, 1.1}, {y, -1.1, 1.1}, {z, -1.1, 1.1}, MaxRecursion -> r]], {r, 0, 4}]-->{0.096103, 1.23869, 4.76033, 20.5314, 118.243}
$endgroup$
– Michael E2
Feb 15 at 13:37
|
show 2 more comments
$begingroup$
Yes like this, thanks. But in my underlying problem I need to use the RegionPlot3D, because ContourPlot3D cannot evaluate.
$endgroup$
– Ulrich Neumann
Feb 15 at 9:27
$begingroup$
Huh? You have to explain that to me...
$endgroup$
– Henrik Schumacher
Feb 15 at 9:28
1
$begingroup$
Have you tried tweaking thePlotPointsandMaxRecursionoptions of yourContourPlot3D? Often when MMA takes a long time to produce a plot, it's simply obsessing over detail you're not really interested in and it pays to reduce the values for these options.
$endgroup$
– Sjoerd Smit
Feb 15 at 10:36
2
$begingroup$
TryingMaxRecursion -> 0andPlotPoints -> 25is always a good start. The result will look very blocky, but the number of function evaluations should be low.
$endgroup$
– Sjoerd Smit
Feb 15 at 12:45
1
$begingroup$
@UlrichNeumann The default forMaxRecursionis2, and time complexity, where significant refinement is called for, can grow exponentially. E.g.Table[First@ AbsoluteTiming[ ContourPlot3D[ x^2 + Sin[6 y] + z^2 == 1, {x, -1.1, 1.1}, {y, -1.1, 1.1}, {z, -1.1, 1.1}, MaxRecursion -> r]], {r, 0, 4}]-->{0.096103, 1.23869, 4.76033, 20.5314, 118.243}
$endgroup$
– Michael E2
Feb 15 at 13:37
$begingroup$
Yes like this, thanks. But in my underlying problem I need to use the RegionPlot3D, because ContourPlot3D cannot evaluate.
$endgroup$
– Ulrich Neumann
Feb 15 at 9:27
$begingroup$
Yes like this, thanks. But in my underlying problem I need to use the RegionPlot3D, because ContourPlot3D cannot evaluate.
$endgroup$
– Ulrich Neumann
Feb 15 at 9:27
$begingroup$
Huh? You have to explain that to me...
$endgroup$
– Henrik Schumacher
Feb 15 at 9:28
$begingroup$
Huh? You have to explain that to me...
$endgroup$
– Henrik Schumacher
Feb 15 at 9:28
1
1
$begingroup$
Have you tried tweaking the
PlotPoints and MaxRecursion options of your ContourPlot3D? Often when MMA takes a long time to produce a plot, it's simply obsessing over detail you're not really interested in and it pays to reduce the values for these options.$endgroup$
– Sjoerd Smit
Feb 15 at 10:36
$begingroup$
Have you tried tweaking the
PlotPoints and MaxRecursion options of your ContourPlot3D? Often when MMA takes a long time to produce a plot, it's simply obsessing over detail you're not really interested in and it pays to reduce the values for these options.$endgroup$
– Sjoerd Smit
Feb 15 at 10:36
2
2
$begingroup$
Trying
MaxRecursion -> 0 and PlotPoints -> 25 is always a good start. The result will look very blocky, but the number of function evaluations should be low.$endgroup$
– Sjoerd Smit
Feb 15 at 12:45
$begingroup$
Trying
MaxRecursion -> 0 and PlotPoints -> 25 is always a good start. The result will look very blocky, but the number of function evaluations should be low.$endgroup$
– Sjoerd Smit
Feb 15 at 12:45
1
1
$begingroup$
@UlrichNeumann The default for
MaxRecursion is 2, and time complexity, where significant refinement is called for, can grow exponentially. E.g. Table[First@ AbsoluteTiming[ ContourPlot3D[ x^2 + Sin[6 y] + z^2 == 1, {x, -1.1, 1.1}, {y, -1.1, 1.1}, {z, -1.1, 1.1}, MaxRecursion -> r]], {r, 0, 4}] --> {0.096103, 1.23869, 4.76033, 20.5314, 118.243}$endgroup$
– Michael E2
Feb 15 at 13:37
$begingroup$
@UlrichNeumann The default for
MaxRecursion is 2, and time complexity, where significant refinement is called for, can grow exponentially. E.g. Table[First@ AbsoluteTiming[ ContourPlot3D[ x^2 + Sin[6 y] + z^2 == 1, {x, -1.1, 1.1}, {y, -1.1, 1.1}, {z, -1.1, 1.1}, MaxRecursion -> r]], {r, 0, 4}] --> {0.096103, 1.23869, 4.76033, 20.5314, 118.243}$endgroup$
– Michael E2
Feb 15 at 13:37
|
show 2 more comments
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f191618%2fonion-plot-of-a-ball%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown