Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3.  
  4. num_colors = 10
  5. values = [x / 10.0 for x in range(5, (10*num_colors)+5, 10)] # [0.5, 1.5, ..., 9.5]
  6. # create example color-map (vertical strides)
  7. list = []
  8. for k in range(10*num_colors):
  9. tmp_list = []
  10. for i in range(len(values)):
  11. for j in range(10):
  12. tmp_list.append(values[i])
  13. list.append(tmp_list)
  14.  
  15. Z = np.array(list)
  16. x = np.arange(0, num_colors, 0.1)
  17. y = np.arange(0, num_colors, 0.1)
  18. xx, yy = np.meshgrid(x, y)
  19.  
  20. plt.contourf(xx, yy, Z, cmap='jet', alpha=1.0)
  21. plt.show()
  22.  
  23. plt.contourf(xx, yy, Z, levels=10, cmap='jet', alpha=1.0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement