How to convert a ListContourPlot into primitive usable with Graphics3D?
$begingroup$
Consider a dataset such as the one you can find here. Using ListContourPlot
on this dataset we get something like the following:
What I want is to have this same image, but as a primitive that can be embedded in a Graphics3D
, so that I can for example stack a number of such images on top of each other.
Is there any easy way to do that?
plotting graphics graphics3d
$endgroup$
add a comment |
$begingroup$
Consider a dataset such as the one you can find here. Using ListContourPlot
on this dataset we get something like the following:
What I want is to have this same image, but as a primitive that can be embedded in a Graphics3D
, so that I can for example stack a number of such images on top of each other.
Is there any easy way to do that?
plotting graphics graphics3d
$endgroup$
add a comment |
$begingroup$
Consider a dataset such as the one you can find here. Using ListContourPlot
on this dataset we get something like the following:
What I want is to have this same image, but as a primitive that can be embedded in a Graphics3D
, so that I can for example stack a number of such images on top of each other.
Is there any easy way to do that?
plotting graphics graphics3d
$endgroup$
Consider a dataset such as the one you can find here. Using ListContourPlot
on this dataset we get something like the following:
What I want is to have this same image, but as a primitive that can be embedded in a Graphics3D
, so that I can for example stack a number of such images on top of each other.
Is there any easy way to do that?
plotting graphics graphics3d
plotting graphics graphics3d
asked 7 hours ago
glSglS
4,96411144
4,96411144
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
Consider modifying your data by adding a dummy $z$ value, used as a sort of index to each dataset, then using ListSliceContourPlot3D
:
Flatten[{{#1, #2, -3, #3}& @@@ data, {#1, #2, 3, 2 #3}& @@@ data}, 1];
ListSliceContourPlot3D[
%,
{"ZStackedPlanes", {-3, 3}},
PlotRange -> {Automatic, Automatic, {-6, 6}}
]
Here I am arbitrarily positioning your original data on the $z=-3$ plane; then creating a new dataset by simply multiplying your original $z$ values by an arbitrary constant, just to have something else to plot.
$endgroup$
add a comment |
$begingroup$
Here is another possibility if you really want to use Graphics3D
with 2D contour plots. I think MarcoB's answer is probably the best, but it might depend on exactly what you're doing with your data.
I define dat
to be the data you linked to on PasteBin.
plot = ListContourPlot[dat, AspectRatio -> 1/2,
ColorFunction -> "TemperatureMap", PlotRangePadding -> 0]
Show[
Graphics3D[{
Texture[plot],
Polygon[{{0, 0, 0}, {2, 0, 0}, {2, 1, 0}, {0, 1, 0}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[plot],
Polygon[{{0, 0, 0.5}, {2, 0, 0.5}, {2, 1, 0.5}, {0, 1, 0.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[plot],
Polygon[{{0, 0, 1}, {2, 0, 1}, {2, 1, 1}, {0, 1, 1}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
}],
Lighting -> {"Ambient", White}
]
Using the Texture
option in Graphics3D
, I can add the plot as the texture of a 2D polygon in 3D space. I believe it will stretch the texture to fit the polygon as long as you specify the VertexTextureCoordinates
to be the 4 corners.
Of course you can make the white border transparent if you prefer, and other tweaks like changing the aspect ratio, etc.
$endgroup$
add a comment |
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%2f192437%2fhow-to-convert-a-listcontourplot-into-primitive-usable-with-graphics3d%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$
Consider modifying your data by adding a dummy $z$ value, used as a sort of index to each dataset, then using ListSliceContourPlot3D
:
Flatten[{{#1, #2, -3, #3}& @@@ data, {#1, #2, 3, 2 #3}& @@@ data}, 1];
ListSliceContourPlot3D[
%,
{"ZStackedPlanes", {-3, 3}},
PlotRange -> {Automatic, Automatic, {-6, 6}}
]
Here I am arbitrarily positioning your original data on the $z=-3$ plane; then creating a new dataset by simply multiplying your original $z$ values by an arbitrary constant, just to have something else to plot.
$endgroup$
add a comment |
$begingroup$
Consider modifying your data by adding a dummy $z$ value, used as a sort of index to each dataset, then using ListSliceContourPlot3D
:
Flatten[{{#1, #2, -3, #3}& @@@ data, {#1, #2, 3, 2 #3}& @@@ data}, 1];
ListSliceContourPlot3D[
%,
{"ZStackedPlanes", {-3, 3}},
PlotRange -> {Automatic, Automatic, {-6, 6}}
]
Here I am arbitrarily positioning your original data on the $z=-3$ plane; then creating a new dataset by simply multiplying your original $z$ values by an arbitrary constant, just to have something else to plot.
$endgroup$
add a comment |
$begingroup$
Consider modifying your data by adding a dummy $z$ value, used as a sort of index to each dataset, then using ListSliceContourPlot3D
:
Flatten[{{#1, #2, -3, #3}& @@@ data, {#1, #2, 3, 2 #3}& @@@ data}, 1];
ListSliceContourPlot3D[
%,
{"ZStackedPlanes", {-3, 3}},
PlotRange -> {Automatic, Automatic, {-6, 6}}
]
Here I am arbitrarily positioning your original data on the $z=-3$ plane; then creating a new dataset by simply multiplying your original $z$ values by an arbitrary constant, just to have something else to plot.
$endgroup$
Consider modifying your data by adding a dummy $z$ value, used as a sort of index to each dataset, then using ListSliceContourPlot3D
:
Flatten[{{#1, #2, -3, #3}& @@@ data, {#1, #2, 3, 2 #3}& @@@ data}, 1];
ListSliceContourPlot3D[
%,
{"ZStackedPlanes", {-3, 3}},
PlotRange -> {Automatic, Automatic, {-6, 6}}
]
Here I am arbitrarily positioning your original data on the $z=-3$ plane; then creating a new dataset by simply multiplying your original $z$ values by an arbitrary constant, just to have something else to plot.
edited 5 hours ago
answered 6 hours ago
MarcoBMarcoB
36.4k556112
36.4k556112
add a comment |
add a comment |
$begingroup$
Here is another possibility if you really want to use Graphics3D
with 2D contour plots. I think MarcoB's answer is probably the best, but it might depend on exactly what you're doing with your data.
I define dat
to be the data you linked to on PasteBin.
plot = ListContourPlot[dat, AspectRatio -> 1/2,
ColorFunction -> "TemperatureMap", PlotRangePadding -> 0]
Show[
Graphics3D[{
Texture[plot],
Polygon[{{0, 0, 0}, {2, 0, 0}, {2, 1, 0}, {0, 1, 0}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[plot],
Polygon[{{0, 0, 0.5}, {2, 0, 0.5}, {2, 1, 0.5}, {0, 1, 0.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[plot],
Polygon[{{0, 0, 1}, {2, 0, 1}, {2, 1, 1}, {0, 1, 1}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
}],
Lighting -> {"Ambient", White}
]
Using the Texture
option in Graphics3D
, I can add the plot as the texture of a 2D polygon in 3D space. I believe it will stretch the texture to fit the polygon as long as you specify the VertexTextureCoordinates
to be the 4 corners.
Of course you can make the white border transparent if you prefer, and other tweaks like changing the aspect ratio, etc.
$endgroup$
add a comment |
$begingroup$
Here is another possibility if you really want to use Graphics3D
with 2D contour plots. I think MarcoB's answer is probably the best, but it might depend on exactly what you're doing with your data.
I define dat
to be the data you linked to on PasteBin.
plot = ListContourPlot[dat, AspectRatio -> 1/2,
ColorFunction -> "TemperatureMap", PlotRangePadding -> 0]
Show[
Graphics3D[{
Texture[plot],
Polygon[{{0, 0, 0}, {2, 0, 0}, {2, 1, 0}, {0, 1, 0}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[plot],
Polygon[{{0, 0, 0.5}, {2, 0, 0.5}, {2, 1, 0.5}, {0, 1, 0.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[plot],
Polygon[{{0, 0, 1}, {2, 0, 1}, {2, 1, 1}, {0, 1, 1}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
}],
Lighting -> {"Ambient", White}
]
Using the Texture
option in Graphics3D
, I can add the plot as the texture of a 2D polygon in 3D space. I believe it will stretch the texture to fit the polygon as long as you specify the VertexTextureCoordinates
to be the 4 corners.
Of course you can make the white border transparent if you prefer, and other tweaks like changing the aspect ratio, etc.
$endgroup$
add a comment |
$begingroup$
Here is another possibility if you really want to use Graphics3D
with 2D contour plots. I think MarcoB's answer is probably the best, but it might depend on exactly what you're doing with your data.
I define dat
to be the data you linked to on PasteBin.
plot = ListContourPlot[dat, AspectRatio -> 1/2,
ColorFunction -> "TemperatureMap", PlotRangePadding -> 0]
Show[
Graphics3D[{
Texture[plot],
Polygon[{{0, 0, 0}, {2, 0, 0}, {2, 1, 0}, {0, 1, 0}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[plot],
Polygon[{{0, 0, 0.5}, {2, 0, 0.5}, {2, 1, 0.5}, {0, 1, 0.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[plot],
Polygon[{{0, 0, 1}, {2, 0, 1}, {2, 1, 1}, {0, 1, 1}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
}],
Lighting -> {"Ambient", White}
]
Using the Texture
option in Graphics3D
, I can add the plot as the texture of a 2D polygon in 3D space. I believe it will stretch the texture to fit the polygon as long as you specify the VertexTextureCoordinates
to be the 4 corners.
Of course you can make the white border transparent if you prefer, and other tweaks like changing the aspect ratio, etc.
$endgroup$
Here is another possibility if you really want to use Graphics3D
with 2D contour plots. I think MarcoB's answer is probably the best, but it might depend on exactly what you're doing with your data.
I define dat
to be the data you linked to on PasteBin.
plot = ListContourPlot[dat, AspectRatio -> 1/2,
ColorFunction -> "TemperatureMap", PlotRangePadding -> 0]
Show[
Graphics3D[{
Texture[plot],
Polygon[{{0, 0, 0}, {2, 0, 0}, {2, 1, 0}, {0, 1, 0}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[plot],
Polygon[{{0, 0, 0.5}, {2, 0, 0.5}, {2, 1, 0.5}, {0, 1, 0.5}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Texture[plot],
Polygon[{{0, 0, 1}, {2, 0, 1}, {2, 1, 1}, {0, 1, 1}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
}],
Lighting -> {"Ambient", White}
]
Using the Texture
option in Graphics3D
, I can add the plot as the texture of a 2D polygon in 3D space. I believe it will stretch the texture to fit the polygon as long as you specify the VertexTextureCoordinates
to be the 4 corners.
Of course you can make the white border transparent if you prefer, and other tweaks like changing the aspect ratio, etc.
answered 5 hours ago
MassDefectMassDefect
1,688310
1,688310
add a comment |
add a comment |
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%2f192437%2fhow-to-convert-a-listcontourplot-into-primitive-usable-with-graphics3d%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