How to contour plot in 3D geometry faces












0














I have plotted a 3D surface using plot_surface(X,Y,Z) in matplotlib. I have results to plot on each surface. How can I plot contour plot in each surface of 3D geometry given in the code.



Can someone help me by plotting and the Z value in X1, Y1, Z1 plane..



from matplotlib import pyplot as plt
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
%matplotlib notebook

length_of_str = 30
width_of_str = 18
height_of_str = 16
mesh = [2, 2, 2]

x = np.arange(0,length_of_str+1,mesh[0])
y = np.arange(0,width_of_str+1,mesh[1])
z = np.arange(0,height_of_str+1,mesh[2])
X1, Y1 = np.meshgrid(x, y)
Z1 = np.zeros((len(y), len(x)))
Z1.fill(height_of_str)

R = np.sqrt(X1**2 + Y1**2)
Z = np.sin(R)

X2, Z2 = np.meshgrid(x, z)
Y2 = np.zeros((len(z), len(x)))
X3, Z3 = np.meshgrid(x, z)
Y3 = np.zeros((len(z), len(x)))
Y3.fill(width_of_str)

Y4, Z4 = np.meshgrid(y, z)
X4 = np.zeros((len(z), len(y)))
Y5, Z5 = np.meshgrid(y, z)
X5 = np.zeros((len(z), len(y)))
X5.fill(length_of_str)


fig = plt.figure()
ax = fig.add_subplot(1,1,1, projection='3d')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.plot_surface(X1, Y1, Z1)
ax.plot_surface(X2, Y2, Z2)
ax.plot_surface(X3, Y3, Z3)
ax.plot_surface(X4, Y4, Z4)
ax.plot_surface(X5, Y5, Z5)
ax.set_xlim(0,max(length_of_str,width_of_str,height_of_str))
ax.set_ylim(0,max(length_of_str,width_of_str,height_of_str))
ax.set_zlim(0,max(length_of_str,width_of_str,height_of_str))
plt.show()









share|improve this question







New contributor




Suraj Ranabhat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0














    I have plotted a 3D surface using plot_surface(X,Y,Z) in matplotlib. I have results to plot on each surface. How can I plot contour plot in each surface of 3D geometry given in the code.



    Can someone help me by plotting and the Z value in X1, Y1, Z1 plane..



    from matplotlib import pyplot as plt
    import numpy as np
    import matplotlib.pyplot as plt
    from mpl_toolkits.mplot3d import Axes3D
    %matplotlib notebook

    length_of_str = 30
    width_of_str = 18
    height_of_str = 16
    mesh = [2, 2, 2]

    x = np.arange(0,length_of_str+1,mesh[0])
    y = np.arange(0,width_of_str+1,mesh[1])
    z = np.arange(0,height_of_str+1,mesh[2])
    X1, Y1 = np.meshgrid(x, y)
    Z1 = np.zeros((len(y), len(x)))
    Z1.fill(height_of_str)

    R = np.sqrt(X1**2 + Y1**2)
    Z = np.sin(R)

    X2, Z2 = np.meshgrid(x, z)
    Y2 = np.zeros((len(z), len(x)))
    X3, Z3 = np.meshgrid(x, z)
    Y3 = np.zeros((len(z), len(x)))
    Y3.fill(width_of_str)

    Y4, Z4 = np.meshgrid(y, z)
    X4 = np.zeros((len(z), len(y)))
    Y5, Z5 = np.meshgrid(y, z)
    X5 = np.zeros((len(z), len(y)))
    X5.fill(length_of_str)


    fig = plt.figure()
    ax = fig.add_subplot(1,1,1, projection='3d')
    ax.set_xlabel('X')
    ax.set_ylabel('Y')
    ax.set_zlabel('Z')
    ax.plot_surface(X1, Y1, Z1)
    ax.plot_surface(X2, Y2, Z2)
    ax.plot_surface(X3, Y3, Z3)
    ax.plot_surface(X4, Y4, Z4)
    ax.plot_surface(X5, Y5, Z5)
    ax.set_xlim(0,max(length_of_str,width_of_str,height_of_str))
    ax.set_ylim(0,max(length_of_str,width_of_str,height_of_str))
    ax.set_zlim(0,max(length_of_str,width_of_str,height_of_str))
    plt.show()









    share|improve this question







    New contributor




    Suraj Ranabhat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0







      I have plotted a 3D surface using plot_surface(X,Y,Z) in matplotlib. I have results to plot on each surface. How can I plot contour plot in each surface of 3D geometry given in the code.



      Can someone help me by plotting and the Z value in X1, Y1, Z1 plane..



      from matplotlib import pyplot as plt
      import numpy as np
      import matplotlib.pyplot as plt
      from mpl_toolkits.mplot3d import Axes3D
      %matplotlib notebook

      length_of_str = 30
      width_of_str = 18
      height_of_str = 16
      mesh = [2, 2, 2]

      x = np.arange(0,length_of_str+1,mesh[0])
      y = np.arange(0,width_of_str+1,mesh[1])
      z = np.arange(0,height_of_str+1,mesh[2])
      X1, Y1 = np.meshgrid(x, y)
      Z1 = np.zeros((len(y), len(x)))
      Z1.fill(height_of_str)

      R = np.sqrt(X1**2 + Y1**2)
      Z = np.sin(R)

      X2, Z2 = np.meshgrid(x, z)
      Y2 = np.zeros((len(z), len(x)))
      X3, Z3 = np.meshgrid(x, z)
      Y3 = np.zeros((len(z), len(x)))
      Y3.fill(width_of_str)

      Y4, Z4 = np.meshgrid(y, z)
      X4 = np.zeros((len(z), len(y)))
      Y5, Z5 = np.meshgrid(y, z)
      X5 = np.zeros((len(z), len(y)))
      X5.fill(length_of_str)


      fig = plt.figure()
      ax = fig.add_subplot(1,1,1, projection='3d')
      ax.set_xlabel('X')
      ax.set_ylabel('Y')
      ax.set_zlabel('Z')
      ax.plot_surface(X1, Y1, Z1)
      ax.plot_surface(X2, Y2, Z2)
      ax.plot_surface(X3, Y3, Z3)
      ax.plot_surface(X4, Y4, Z4)
      ax.plot_surface(X5, Y5, Z5)
      ax.set_xlim(0,max(length_of_str,width_of_str,height_of_str))
      ax.set_ylim(0,max(length_of_str,width_of_str,height_of_str))
      ax.set_zlim(0,max(length_of_str,width_of_str,height_of_str))
      plt.show()









      share|improve this question







      New contributor




      Suraj Ranabhat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I have plotted a 3D surface using plot_surface(X,Y,Z) in matplotlib. I have results to plot on each surface. How can I plot contour plot in each surface of 3D geometry given in the code.



      Can someone help me by plotting and the Z value in X1, Y1, Z1 plane..



      from matplotlib import pyplot as plt
      import numpy as np
      import matplotlib.pyplot as plt
      from mpl_toolkits.mplot3d import Axes3D
      %matplotlib notebook

      length_of_str = 30
      width_of_str = 18
      height_of_str = 16
      mesh = [2, 2, 2]

      x = np.arange(0,length_of_str+1,mesh[0])
      y = np.arange(0,width_of_str+1,mesh[1])
      z = np.arange(0,height_of_str+1,mesh[2])
      X1, Y1 = np.meshgrid(x, y)
      Z1 = np.zeros((len(y), len(x)))
      Z1.fill(height_of_str)

      R = np.sqrt(X1**2 + Y1**2)
      Z = np.sin(R)

      X2, Z2 = np.meshgrid(x, z)
      Y2 = np.zeros((len(z), len(x)))
      X3, Z3 = np.meshgrid(x, z)
      Y3 = np.zeros((len(z), len(x)))
      Y3.fill(width_of_str)

      Y4, Z4 = np.meshgrid(y, z)
      X4 = np.zeros((len(z), len(y)))
      Y5, Z5 = np.meshgrid(y, z)
      X5 = np.zeros((len(z), len(y)))
      X5.fill(length_of_str)


      fig = plt.figure()
      ax = fig.add_subplot(1,1,1, projection='3d')
      ax.set_xlabel('X')
      ax.set_ylabel('Y')
      ax.set_zlabel('Z')
      ax.plot_surface(X1, Y1, Z1)
      ax.plot_surface(X2, Y2, Z2)
      ax.plot_surface(X3, Y3, Z3)
      ax.plot_surface(X4, Y4, Z4)
      ax.plot_surface(X5, Y5, Z5)
      ax.set_xlim(0,max(length_of_str,width_of_str,height_of_str))
      ax.set_ylim(0,max(length_of_str,width_of_str,height_of_str))
      ax.set_zlim(0,max(length_of_str,width_of_str,height_of_str))
      plt.show()






      python-3.x






      share|improve this question







      New contributor




      Suraj Ranabhat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Suraj Ranabhat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Suraj Ranabhat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Dec 27 at 13:18









      Suraj Ranabhat

      11




      11




      New contributor




      Suraj Ranabhat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Suraj Ranabhat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Suraj Ranabhat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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
          });


          }
          });






          Suraj Ranabhat is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53945755%2fhow-to-contour-plot-in-3d-geometry-faces%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Suraj Ranabhat is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Suraj Ranabhat is a new contributor. Be nice, and check out our Code of Conduct.













          Suraj Ranabhat is a new contributor. Be nice, and check out our Code of Conduct.












          Suraj Ranabhat is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Stack Overflow!


          • 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.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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.


          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%2fstackoverflow.com%2fquestions%2f53945755%2fhow-to-contour-plot-in-3d-geometry-faces%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

          Mossoró

          Error while reading .h5 file using the rhdf5 package in R

          Pushsharp Apns notification error: 'InvalidToken'