Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. from mpl_toolkits.mplot3d import Axes3D
  2. import matplotlib.pyplot as plt
  3. from matplotlib import cm
  4. from matplotlib.ticker import LinearLocator, FormatStrFormatter
  5. import numpy as np
  6.  
  7.  
  8. fig = plt.figure()
  9. ax = fig.gca(projection='3d')
  10.  
  11. #time of use periods
  12. periods = np.array([[ i for i in range(1,49)]]*365)
  13.  
  14. # dummy load for now
  15. load = np.array([[(i**3-i**2+i) for i in range(1,49)]]*365)
  16.  
  17. # create a matrix of days from day 1 to 365
  18. # clumsy can be improved with list comprehension
  19. date = []
  20. for i in range(1,366):
  21. l = [ i for x in range(1,49)]
  22. date.append(l)
  23. date = np.array(date)
  24.  
  25. # Plot the surface.
  26. surf = ax.plot_surface(date, periods, load, cmap=cm.coolwarm,
  27. linewidth=0, antialiased=False)
  28.  
  29. # Customize the z axis.
  30. #ax.set_zlim(-1.01, 1.01)
  31. #ax.zaxis.set_major_locator(LinearLocator(10))
  32. #ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f'))
  33.  
  34. # Add a color bar which maps values to colors.
  35. #fig.colorbar(surf, shrink=0.5, aspect=5)
  36.  
  37. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement