Created
March 5, 2014 09:19
-
-
Save chengui/9363924 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mpl_toolkits.mplot3d import Axes3D | |
import matplotlib.pyplot as plt | |
import numpy as np | |
fig = plt.figure() | |
ax = fig.add_subplot(111, projection='3d') | |
for c, z in zip(['r', 'g', 'b', 'y'], [30, 20, 10, 0]): | |
xs = np.arange(20) | |
ys = np.random.rand(20) | |
# You can provide either a single color or an array. To demonstrate this, | |
# the first bar of each set will be colored cyan. | |
cs = [c] * len(xs) | |
cs[0] = 'c' | |
ax.bar(xs, ys, zs=z, zdir='y', color=cs, alpha=0.8) | |
ax.set_xlabel('X') | |
ax.set_ylabel('Y') | |
ax.set_zlabel('Z') | |
plt.show() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment