Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to draw Bar Chart many times by python

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

Most people do not understand the knowledge points of this article "python how to draw a bar chart for many times", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "python how to draw a bar chart many times" article.

The running result is as follows

The code is as follows

From matplotlib import pyplot as pltif _ _ name__ = "_ _ main__": a = ["Wolf Warriors 2", "Fast and Furious 8", "Kung Fu Yoga", "Journey to the West", "Transformers 5", "Wrestling! Dad, "Pirates of the Caribbean 5", "King Kong: skull Island", "extreme agents", "biochemical Evil 6", "braving the Wind and waves", "God stealing Daddy", "outwitting Tiger Mountain", "brain Tianzhu", "Wolverine 3", "Spider-Man", "Wukong", "Guardians of the Galaxy 2", "Love Sage" "Shin Munai"] b = [56.01, 26.94, 17.63, 16.49, 15.45, 12.96, 11.61, 11.28, 10.42, 8.75, 7.52, 6.99, 6.86, 6.86, 6.58, 6.23] # set the size of the graph plt.figure (figsize= (20), dpi=80) # draw the bar graph plt.barh (a line bmoment 0.3 color = "orange") plt.yticks (a Fontproperties='KaiTi') plt.xlabel ("Box Office (100 million)", fontproperties='KaiTi',size=25) plt.ylabel ("Movie name", fontproperties='KaiTi',size=25) plt.title ("Cinema Box Rank", fontproperties='KaiTi' Size=35) plt.show () from matplotlib import pyplot as pltfrom matplotlib import font_managerif _ _ name__ = = "_ _ main__": font = font_manager.FontProperties (fname='C:/Windows/fonts/simkai.ttf') a = ["rise of the Planet of the Apes: the Ultimate Battle", "Dunkirk", "Spider-Man: the return of Heroes" "Wolf Warriors 2"] baked 16 = [15746 312 4997319] baked 15 = [12357 pyrrhic 156 2045168] baked 14 = [2358 dint 399 399 2358362] bar_width=0.2 # key points Move the x axis to the right x len 14 = list (range (len (a) x bike 15 = [i+bar_width*2 for i in x bike 14] # set the size of the graph pixel plt.figure (figsize= (10Power5)) # draw a bar graph plt.bar (range (len (a)), baud 14 (len (a)) plt.bar (September 15, len 15) Width=bar_width,label= "15 September") plt.bar (Xerox 16, width=bar_width,label= 16, width=bar_width,label= "16 Sep") # set the x-axis scale plt.xticks (Xerox 15, a KaiTi property = "KaiTi") # set the legend plt.legend (prop=font) plt.xlabel ("movie name", fontproperties= "KaiTi", size=20) plt.ylabel ("Box Office", fontproperties= "KaiTi") Size=20) plt.title ("Box Office changes over time", fontproperties= "KaiTi", size=30) plt.show () above is the content of this article on "how to draw a bar chart multiple times by python". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report