Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How can I give a 3D dimension of a layer with Python?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 30
    Answer it

    I need your help with a problem regarding the 3d plot. I have created a layer T2 with the below code, and what I what it to do is to give this layer a volume with a third dimension. That means to be raised it, let's say 2 or 3 units, and from an original layer to create a voxel. Is it possible to change something to my code to do something like that?

     

    import numpy as np
    import matplotlib.pyplot as plt
    from mpl_toolkits.mplot3d import axes3d
    
    
    def f2(x2, y2):
        return np.sqrt(x2**2+y2**2)
    
    x2 = np.arange(7)
    y2 = np.arange(10)
    
    
    X2, Y2 = np.meshgrid(x2, y2)
    
    T2 = f2(X2, Y2)
    plt.imshow(T2.reshape(X2.shape),
               origin='lower', aspect='auto',
               extent=[0, 10, 0, 10],
               cmap='Blues')
    cb = plt.colorbar()
    cb.set_label("density")

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: