Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from mpl_toolkits.mplot3d import Axes3D
- import matplotlib.pyplot as plt
- import numpy as np
- ### NOTE: make one of these an exact density or KDE to exactly match your plot intention.
- randns1 = np.random.normal(size=10000)
- counts1, bins1 = np.histogram(randns1, bins=30)
- randns2 = np.random.normal(size=10000)
- counts2, bins2 = np.histogram(randns2, bins=30)
- data = np.array([counts1,counts2])
- ## other data
- fig = plt.figure()
- ax = fig.add_subplot(111, projection='3d')
- colors = ["r","g","b"]*10
- ## Draw 3D hist
- ncnt, nbins = data.shape[:2]
- xs_new = np.arange(-3,3,6/30)
- for i in range(ncnt):
- ys = data[i]
- cs = [colors[i]] * nbins
- ax.bar(xs_new, ys.ravel(), zs=i, zdir='x', color=cs, alpha=0.8)
- ax.set_axis_off()
- x = np.linspace(0, 1, 1000)
- y = randns1[::10]
- ax.plot(x, y, zs=0, zdir='z', label='curve in (x,y)')
- # ax.set_xlabel('idx')
- # ax.set_ylabel('bins')
- # ax.set_zlabel('nums')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement