Advertisement
Arfizato

Untitled

Apr 25th, 2022
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. sns.set_theme(style="whitegrid")
  2. #initializing matplotlib figure
  3. f, ax= plt.subplots(figsize=(20,10))
  4.  
  5. #plotting types
  6. sns.set_color_codes("pastel")
  7. sns.barplot(x="Total" ,y="Type",data=cleanFraud,color="b" )
  8.  
  9. #plotting fraud
  10. sns.set_color_codes("muted")
  11. sns.barplot(x="Total_Fraud", y="Type", data= cleanFraud, color="b" )
  12.  
  13. # more information
  14. ax.set(xlim=(0,2500000), xlabel="Total Number of Fraudulent Transactions Per Total transactions" )
  15. sns.despine(left=True, bottom=True)
  16.  
  17. index=0
  18. print(len(ax.patches))
  19. for p in ax.patches:
  20. # ax.annotate((p.get_height()), (p.get_x()+0.30, p.get_height()+300))
  21. if index< len(ax.patches)/2:
  22. ax.annotate((p.get_width()), (p.get_width()+700,p.get_y()))
  23. else:
  24. ax.annotate((p.get_width()), (p.get_width(),p.get_y()))
  25.  
  26. # print(p.get_width(),"\n")
  27. index+=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement