Advertisement
UF6

Group Project 2, Problem 13

UF6
Apr 19th, 2016
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. from mpl_toolkits.mplot3d import Axes3D
  2. %matplotlib notebook
  3. import matplotlib.pyplot as plt
  4. import numpy as np
  5. #ok
  6. fig = plt.figure()
  7. ax = fig.add_subplot(111, projection='3d')
  8.  
  9. '''Prepare the 2D domain: x from -5 to 5 and y from -5 to 5'''
  10. x,y = np.meshgrid(np.linspace(-5,5,21),np.linspace(-5,5,21))
  11.  
  12. t = np.linspace(-5,5,21)
  13. x = 3*t
  14. y = 1+t
  15. z = 2-t
  16. ax.plot (x,y,z)
  17.  
  18. '''z for the first plane'''
  19. x,y = np.meshgrid(np.linspace(-5,5,21),np.linspace(-5,5,21))
  20. z = -16-8*x-8*y
  21. ax.plot_wireframe(x,y,z,color='red')
  22.  
  23.  
  24. ax.set_xlabel('x')
  25. ax.set_ylabel('y')
  26. ax.set_zlabel('z')
  27. ax.set_title('Plot of 2 Planes')
  28.  
  29. ax.view_init(-99,37)
  30. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement