Get the App
SLTechnology News&Howtos  ›  Development  › 

How to draw Bar Chart many times by python

Shulou Source: shulou.com Published: 2022-05-31 20:31:56 10月02日 Update

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.

Tags: Bar content box office movie King Kong name figure size situation article knowledge article spider spider-man ride the wind and waves pixel scale kung fu crisis Transformers Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Microsoft macOS MariaDB Shulou Technology