Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from mpl_toolkits.mplot3d import Axes3D
- import matplotlib.pyplot as plt
- from matplotlib import cm
- from matplotlib.ticker import LinearLocator, FormatStrFormatter
- import numpy as np
- fig = plt.figure()
- ax = fig.gca(projection='3d')
- #time of use periods
- periods = np.array([[ i for i in range(1,49)]]*365)
- # dummy load for now
- load = np.array([[(i**3-i**2+i) for i in range(1,49)]]*365)
- # create a matrix of days from day 1 to 365
- # clumsy can be improved with list comprehension
- date = []
- for i in range(1,366):
- l = [ i for x in range(1,49)]
- date.append(l)
- date = np.array(date)
- # Plot the surface.
- surf = ax.plot_surface(date, periods, load, cmap=cm.coolwarm,
- linewidth=0, antialiased=False)
- # Customize the z axis.
- #ax.set_zlim(-1.01, 1.01)
- #ax.zaxis.set_major_locator(LinearLocator(10))
- #ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f'))
- # Add a color bar which maps values to colors.
- #fig.colorbar(surf, shrink=0.5, aspect=5)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement