Guest User

Untitled

a guest
Nov 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. import numpy as np
  2. import pandas as pd
  3. import matplotlib.pyplot as plt
  4.  
  5. data = [[20, 35, 30, 40], [25, 40, 45, 30],
  6. [15, 20, 35, 45], [10, 25, 40, 15],
  7. [50, 20, 45, 55], [10, 55, 60, 20]]
  8. data_std = [[1, 2, 1, 2], [1, 2, 1, 2], [1, 2, 1, 2],
  9. [1, 2, 1, 2], [1, 2, 1, 2], [1, 2, 1, 2]]
  10.  
  11. length = len(data)
  12. x_labels = ['A', 'B', 'C', 'D', 'E', 'F']
  13.  
  14. # Set plot parameters
  15. fig, ax = plt.subplots()
  16. width = 0.2 # width of bar
  17. x = np.arange(length)
  18.  
  19. ax.bar(x, data[0][0], width, color='#000080', label='Case-1', yerr=data_std[0][0])
  20. ax.bar(x + width, data[0][1], width, color='#0F52BA', label='Case-2', yerr=data_std[0][1])
  21. ax.bar(x + (2 * width), data[0][2], width, color='#6593F5', label='Case-3', yerr=data_std[0][2])
  22. ax.bar(x + (3 * width), data[0][3], width, color='#73C2FB', label='Case-4', yerr=data_std[0][3])
  23.  
  24. ax.set_ylabel('Metric')
  25. ax.set_ylim(0,75)
  26. ax.set_xticks(x + width + width/2)
  27. ax.set_xticklabels(x_labels)
  28. ax.set_xlabel('Scenario')
  29. ax.set_title('Title')
  30. ax.legend()
  31. plt.grid(True, 'major', 'y', ls='--', lw=.5, c='k', alpha=.3)
  32.  
  33. fig.tight_layout()
  34. plt.show()
Add Comment
Please, Sign In to add comment