this article illustrates the function of Python using the pie function of Matplotlib to draw the pie chart. Share to you for your reference, as follows:

matplotlib specific installation method can refer to a ", the use of specific code as follows:

 #coding=utf8 import Matplotlib as MPL import numpy as NP import matplotlib.pyplot as PLT 'matplotlib.pyplot.pie function: draw a pie chart of matplotlib.pyplot.pie (x, explode=None, labels=None. Colors=None, autopct=None, pctdistance=0.6, shadow=False, labeldistance=1.1, startangle=, None, radius=None, counterclock=True, wedgeprops=None, textprops=None, center= (0, 0), frame=False, rotatelabels=False, hold=None, data=None) parameters: X: array. The input data is used to create a pie chart. Explode: an array, an optional parameter, and a default of None. If not None, an array of the same length as X is used to specify the offset of each part. For example: explode=[0,0,0.2,0,0], second pieces of cake were dragged out. Labels: list, optional parameters, by default: None. A string sequence is used as a marker for each piece of cake. Colors: an array, an optional parameter, and the default is: None. The Matplotlib color parameter sequence used to label each piece of pie chart. If it is None, the color of the current active ring will be used. Autopct: the default is a None, a string or a function, and an optional parameter. If not None, a string or function is tagged with a numeric pie chart. Pctdistance: floating-point number, optional parameter, default: 0.6. The ratio between the center of each slice and the beginning of the text generated by the autopct. If autopct is None, it is ignored. Shadow: Boolean, optional parameters, default: False. Draw a shadow under the pie chart. Labeldistance: floating-point number, optional parameter, default: 1.1. The diameter of the mark by yourselves. Startangle: floating-point type, optional parameter, default: None. If not None, revolve the start angle of the pie chart from the X axis counter clockwise. Radius: floating-point type, optional parameter, default: None. The radius of the pie chart, if the radius is None, will be set to 1. Counterclock: Boolean value, optional parameter, default is: None. Specify the direction of the pointer, clockwise or counter clockwise. Wedgeprops: dictionary type, optional parameter, default value: None. The parameter dictionary is passed to the wedge object to draw a pie chart. For example: wedgeprops={'linewidth': 3} set wedge line width to 3. Textprops: dictionary type, optional parameter, the default value is: None. The dictionary parameters that are passed to the text object. Center: list of floating-point types, optional parameters, default values: (0,0). The center position of the icon. Frame: Boolean type, optional parameter, default value: False. If it is true, draw the axis frame with the table. Rotatelabels: Boolean type, optional parameter, default is: False. If it is True, rotate each label to the specified angle. Return value: patches: list. A list of matplotlib.patches.Wedge instances. Text: list. The list of matplotlib.text.Text instance label. Autotexts: list. A is a list of Text instances of a digital label. Only when the parameter autopct is not None is returned. '# set the font style mpl.rcParams['']='sans-serif' mpl.rcParams['font.sans-serif']=[u'SimHei'] # random integer from 1-11, were randomly divided into five parts of data=np.random.randint (1,11,5) # set second cake offset is 0.2 plt.pie (data explode=[0,0,0.2,0,0]) plt.title (U pie ") (

more about the Python related content can see the special station:" Python "math skills summary," Python ", a regular expression Usage Summary" Python data structure and algorithm tutorial "," Python function skills summary "", "Python string operation skills summary " and "Python entry and advanced classic tutorial " , hope that this article is helpful for everyone's program design.

This concludes the body part