Guest User

Untitled

a guest
Jul 22nd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. # number of variable
  2. categories=list(data)[0:]
  3. N = len(categories)
  4.  
  5. # Angles for plotting
  6. angles = [n / float(N) * 2 * pi for n in range(N)]
  7. angles += angles[:1]
  8.  
  9. # Initialise
  10. f, ax = plt.subplots(1,1,figsize=(40,20))
  11. ax = plt.subplot(111, polar=True)
  12.  
  13. # Draw one axe per variable
  14. plt.xticks(angles[:-1], color='grey', size=16)
  15.  
  16. # the main problem in my code - placing yticks 'around' the plot
  17. # to be near the corresponding values
  18. for idx, an in enumerate(angles):
  19. ax.set_rlabel_position(an) # positioning labels at a given angle
  20. tick_values = [blue_values[idx],red_values[idx]] # to get the two labels values
  21. plt.yticks(tick_values, [x.rstrip('.0') for x in list(map(str, tick_values))], color="black", size=16)
  22.  
  23. plt.ylim(0,max(red_values))
  24.  
  25. # Add plots
  26. # Plot data
  27. ax.plot(angles, blue_values, linewidth=1, linestyle='solid')
  28. # Fill area
  29. ax.fill(angles, blue_values, 'b', alpha=0.5)
  30.  
  31. # Plot data
  32. ax.plot(angles, red_values, linewidth=1, linestyle='solid')
  33. # Fill area
  34. ax.fill(angles, red_values, 'r', alpha=0.2)
Add Comment
Please, Sign In to add comment