Guest User

Untitled

a guest
Jan 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3.  
  4. x = []
  5. l = []
  6. n = int(input('Введите количество столбцов '))
  7. for i in range(n):
  8. newKey = input('Введите имя столбца ')
  9. newValue = int(input('Введите значение cтолбца '))
  10. l.append(newKey)
  11. x.append(newValue)
  12.  
  13.  
  14. y = np.arange(len(x))
  15.  
  16. plt.bar(y,x, align='center')
  17. plt.xticks(y, l)
  18. plt.show()
  19.  
  20. from mpl_toolkits.mplot3d import Axes3D
  21. import matplotlib.pyplot as plt
  22. import numpy as np
  23.  
  24. fig = plt.figure()
  25. ax = fig.add_subplot(111, projection='3d')
  26. ax.bar3d(np.arange(2006, 2011), 1, 9,
  27. 0.4, 0.5, np.random.randint(10,50,5),
  28. alpha=0.1)
  29.  
  30. fig = plt.figure()
  31. ax = fig.add_subplot(111, projection='3d')
  32. x = [2006,2007,2008,2009]
  33. y = [0]*len(x); z = [0]*len(x); dx = 0.6; dy = 0.5
  34. dz = [50, 30, 10, 40]
  35. ax.bar3d(x, y, z, dx, dy, dz, color='yellow', zorder='max')
  36. # adding labels
  37. for xx,yy,zz in zip(x,y,dz):
  38. ax.text(xx,yy+dy/2,zz*1.025, str(zz),
  39. family='monospace', size='larger', weight='bold', color='b')
  40. ax.bar3d(x, 1, z, 0, 0.5, 0, color='white', zorder=-1)
  41. plt.xticks(x, x)
  42. plt.yticks(y, y)
Add Comment
Please, Sign In to add comment