前言
本文的文字及图片来源于网络,仅供学习、交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
from math import pi import 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( 111 ) plt.xticks(x_as) ax.plot(x_as, values, linewidth = 1 , linestyle = 'solid' , zorder = 3 ) plt.show() |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import matplotlib.pyplot as plt from palettable.colorbrewer.qualitative import Pastel1_7 my_dpi = 96 plt.figure(figsize = ( 480 / my_dpi, 480 / my_dpi), dpi = my_dpi) names = 'groupA' , 'groupB' , 'groupC' , 'groupD' , size = [ 12 , 11 , 3 , 30 ] my_circle = plt.Circle( ( 0 , 0 ), 0.7 , color = 'white' ) plt.pie(size, labels = names, colors = Pastel1_7.hex_colors) p = plt.gcf() p.gca().add_artist(my_circle) plt.show() |
1
2
3
4
5
6
7
|
import pandas as pd import matplotlib.pyplot as plt df = pd.DataFrame([ 8 , 8 , 1 , 2 ], index = [ 'a' , 'b' , 'c' , 'd' ], columns = [ 'x' ]) my_dpi = 96 plt.figure(figsize = ( 480 / my_dpi, 480 / my_dpi), dpi = my_dpi) df.plot(kind = 'pie' , subplots = True , figsize = ( 8 , 8 )) plt.show() |
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。
原文链接:https://www.cnblogs.com/zwhy8/p/13285708.html