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 pie chart, broken line chart and circle chart by Python

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

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how Python draws pie charts, broken lines and circles. It is very detailed and has a certain reference value. Friends who are interested must read it!

Example:

From math import piimport matplotlib.pyplot as plt cat = ['Speed',' Reliability', 'Comfort',' Safety', 'Effieciency'] values = [90,60,65,70,40] N = len (cat) x_as = [n / float (N) * 2 * pi for n in range (N)] ax = plt.subplot (111plt.xticks (x_as) ax.plot (x_as, values, linewidth=1, linestyle='solid', zorder=3) plt.show ()

Import matplotlib.pyplot as pltfrom palettable.colorbrewer.qualitative import Pastel1_7my_dpi=96plt.figure (figsize= (480/my_dpi, 480/my_dpi), dpi=my_dpi) names='groupA', 'groupB',' groupC', 'groupD',size= [12 my_circle=plt.Circle ((0L0), color='white') plt.pie (size, labels=names Colors=Pastel1_7.hex_colors) p=plt.gcf () p.gca (). Add_artist (my_circle) plt.show () import pandas as pdimport matplotlib.pyplot as pltdf = pd.DataFrame ([8 beacons, 1 add_artist 2], index= ['ahem,' baked, 'crested,' d'], columns= ['x']) my_dpi=96plt.figure (figsize= (480/my_dpi, 480/my_dpi), dpi=my_dpi) df.plot (kind='pie', subplots=True, figsize= (8)) plt.show ()

The above is all the contents of the article "how to draw pie charts, broken lines and circles in Python". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow 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

Internet Technology

Wechat

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

12
Report