Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- x = []
- l = []
- n = int(input('Введите количество столбцов '))
- for i in range(n):
- newKey = input('Введите имя столбца ')
- newValue = int(input('Введите значение cтолбца '))
- l.append(newKey)
- x.append(newValue)
- y = np.arange(len(x))
- plt.bar(y,x, align='center')
- plt.xticks(y, l)
- plt.show()
- 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')
- ax.bar3d(np.arange(2006, 2011), 1, 9,
- 0.4, 0.5, np.random.randint(10,50,5),
- alpha=0.1)
- fig = plt.figure()
- ax = fig.add_subplot(111, projection='3d')
- x = [2006,2007,2008,2009]
- y = [0]*len(x); z = [0]*len(x); dx = 0.6; dy = 0.5
- dz = [50, 30, 10, 40]
- ax.bar3d(x, y, z, dx, dy, dz, color='yellow', zorder='max')
- # adding labels
- for xx,yy,zz in zip(x,y,dz):
- ax.text(xx,yy+dy/2,zz*1.025, str(zz),
- family='monospace', size='larger', weight='bold', color='b')
- ax.bar3d(x, 1, z, 0, 0.5, 0, color='white', zorder=-1)
- plt.xticks(x, x)
- plt.yticks(y, y)
Add Comment
Please, Sign In to add comment