How to convert a ListContourPlot into primitive usable with Graphics3D?












4












$begingroup$


Consider a dataset such as the one you can find here. Using ListContourPlot on this dataset we get something like the following:



enter image description here



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?










share|improve this question









$endgroup$

















    4












    $begingroup$


    Consider a dataset such as the one you can find here. Using ListContourPlot on this dataset we get something like the following:



    enter image description here



    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?










    share|improve this question









    $endgroup$















      4












      4








      4





      $begingroup$


      Consider a dataset such as the one you can find here. Using ListContourPlot on this dataset we get something like the following:



      enter image description here



      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?










      share|improve this question









      $endgroup$




      Consider a dataset such as the one you can find here. Using ListContourPlot on this dataset we get something like the following:



      enter image description here



      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 5 hours ago









      glSglS

      4,96411144




      4,96411144






















          2 Answers
          2






          active

          oldest

          votes


















          3












          $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}}
          ]


          Mathematica graphics



          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.






          share|improve this answer











          $endgroup$





















            1












            $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]


            Contour plot of OP's data.



            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.



            Contour plots in 3D space.



            Of course you can make the white border transparent if you prefer, and other tweaks like changing the aspect ratio, etc.






            share|improve this answer









            $endgroup$













              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
              });


              }
              });














              draft saved

              draft discarded


















              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









              3












              $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}}
              ]


              Mathematica graphics



              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.






              share|improve this answer











              $endgroup$


















                3












                $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}}
                ]


                Mathematica graphics



                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.






                share|improve this answer











                $endgroup$
















                  3












                  3








                  3





                  $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}}
                  ]


                  Mathematica graphics



                  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.






                  share|improve this answer











                  $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}}
                  ]


                  Mathematica graphics



                  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.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 3 hours ago

























                  answered 3 hours ago









                  MarcoBMarcoB

                  36.4k556112




                  36.4k556112























                      1












                      $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]


                      Contour plot of OP's data.



                      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.



                      Contour plots in 3D space.



                      Of course you can make the white border transparent if you prefer, and other tweaks like changing the aspect ratio, etc.






                      share|improve this answer









                      $endgroup$


















                        1












                        $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]


                        Contour plot of OP's data.



                        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.



                        Contour plots in 3D space.



                        Of course you can make the white border transparent if you prefer, and other tweaks like changing the aspect ratio, etc.






                        share|improve this answer









                        $endgroup$
















                          1












                          1








                          1





                          $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]


                          Contour plot of OP's data.



                          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.



                          Contour plots in 3D space.



                          Of course you can make the white border transparent if you prefer, and other tweaks like changing the aspect ratio, etc.






                          share|improve this answer









                          $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]


                          Contour plot of OP's data.



                          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.



                          Contour plots in 3D space.



                          Of course you can make the white border transparent if you prefer, and other tweaks like changing the aspect ratio, etc.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 3 hours ago









                          MassDefectMassDefect

                          1,688310




                          1,688310






























                              draft saved

                              draft discarded




















































                              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.




                              draft saved


                              draft discarded














                              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





















































                              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







                              Popular posts from this blog

                              Ponta tanko

                              Tantalo (mitologio)

                              Erzsébet Schaár