diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 76dc174e2f53..d78581b85485 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2475,8 +2475,7 @@ def pie(self, x, explode=None, labels=None, colors=None, startangle=None, radius=None, counterclock=True, wedgeprops=None, textprops=None, center=(0, 0), frame=False, rotatelabels=False): - r""" - Plot a pie chart. + r"""Plot a pie chart. Make a pie chart of array *x*. The fractional area of each wedge is given by x/sum(x). If sum(x) <= 1, then the values @@ -2484,90 +2483,93 @@ def pie(self, x, explode=None, labels=None, colors=None, be normalized. The wedges are plotted counterclockwise, by default starting from the x-axis. - Keyword arguments: + Parameters + ---------- + x : array + The input array used to make the pie chart. - *explode*: [ *None* | len(x) sequence ] + explode : None or array If not *None*, is a ``len(x)`` array which specifies the fraction of the radius with which to offset each wedge. - *colors*: [ *None* | color sequence ] + colors : None or array A sequence of matplotlib color args through which the pie chart will cycle. If `None`, will use the colors in the currently active cycle. - *labels*: [ *None* | len(x) sequence of strings ] + labels : None or list A sequence of strings providing the labels for each wedge - *autopct*: [ *None* | format string | format function ] + autopct : None or string or function If not *None*, is a string or function used to label the wedges with their numeric value. The label will be placed inside the wedge. If it is a format string, the label will be ``fmt%pct``. If it is a function, it will be called. - *pctdistance*: scalar + pctdistance : float The ratio between the center of each pie slice and the start of the text generated by *autopct*. Ignored if *autopct* is *None*; default is 0.6. - *labeldistance*: scalar + labeldistance : float The radial distance at which the pie labels are drawn - *shadow*: [ *False* | *True* ] + shadow : bool Draw a shadow beneath the pie. - *startangle*: [ *None* | Offset angle ] + startangle : None or float If not *None*, rotates the start of the pie chart by *angle* degrees counterclockwise from the x-axis. - *radius*: [ *None* | scalar ] + radius : None or float The radius of the pie, if *radius* is *None* it will be set to 1. - *counterclock*: [ *False* | *True* ] + counterclock : bool Specify fractions direction, clockwise or counterclockwise. - *wedgeprops*: [ *None* | dict of key value pairs ] + wedgeprops : None or dict Dict of arguments passed to the wedge objects making the pie. For example, you can pass in wedgeprops = { 'linewidth' : 3 } to set the width of the wedge border lines equal to 3. For more details, look at the doc/arguments of the wedge object. By default `clip_on=False`. - *textprops*: [ *None* | dict of key value pairs ] + textprops : None or dict Dict of arguments to pass to the text objects. - *center*: [ (0,0) | sequence of 2 scalars ] - Center position of the chart. - - *frame*: [ *False* | *True* ] - Plot axes frame with the chart. + center : list of float + Center position of the chart. Takes value (0,0) or is a sequence + of 2 scalars. - *rotatelabels*: [ *False* | *True* ] - Rotate each label to the angle of the corresponding slice. + frame : bool + Plot axes frame with the chart if true. - The pie chart will probably look best if the figure and axes are - square, or the Axes aspect is equal. e.g.:: + rotatelabels : bool + Rotate each label to the angle of the corresponding slice if true. - figure(figsize=(8,8)) - ax = axes([0.1, 0.1, 0.8, 0.8]) + Returns + ------- + patches : list + A sequence of :class:`matplotlib.patches.Wedge` instances - or:: + texts : list + A is a list of the label :class:`matplotlib.text.Text` instances. - axes(aspect=1) + autotexts : list + A is a list of :class:`~matplotlib.text.Text` instances for the + numeric labels. Is returned only if parameter *autopct* is + not *None*. - Return value: - If *autopct* is *None*, return the tuple (*patches*, *texts*): + Notes + -------- + The pie chart will probably look best if the figure and axes are + square, or the Axes aspect is equal. - - *patches* is a sequence of - :class:`matplotlib.patches.Wedge` instances + >>> figure(figsize=(8,8)) + >>> ax = axes([0.1, 0.1, 0.8, 0.8]) - - *texts* is a list of the label - :class:`matplotlib.text.Text` instances. + >>> axes(aspect=1) - If *autopct* is not *None*, return the tuple (*patches*, - *texts*, *autotexts*), where *patches* and *texts* are as - above, and *autotexts* is a list of - :class:`~matplotlib.text.Text` instances for the numeric - labels. """ x = np.array(x, np.float32) diff --git a/lib/matplotlib/tests/test_backend_pgf.py b/lib/matplotlib/tests/test_backend_pgf.py index 52151256f71a..36120aa785cf 100644 --- a/lib/matplotlib/tests/test_backend_pgf.py +++ b/lib/matplotlib/tests/test_backend_pgf.py @@ -81,9 +81,13 @@ def create_figure(): # test compiling a figure to pdf with xelatex +<<<<<<< HEAD @needs_xelatex @pytest.mark.style('default') @pytest.mark.backend('pgf') +======= +@switch_backend('pgf') +>>>>>>> 40d5e418e... FIX small nitpicks def test_xelatex(): rc_xelatex = {'font.family': 'serif', 'pgf.rcfonts': False} @@ -93,9 +97,13 @@ def test_xelatex(): # test compiling a figure to pdf with pdflatex +<<<<<<< HEAD @needs_pdflatex @pytest.mark.style('default') @pytest.mark.backend('pgf') +======= +@switch_backend('pgf') +>>>>>>> 40d5e418e... FIX small nitpicks def test_pdflatex(): import os if os.environ.get('APPVEYOR', False): @@ -113,10 +121,14 @@ def test_pdflatex(): # test updating the rc parameters for each figure +<<<<<<< HEAD @needs_xelatex @needs_pdflatex @pytest.mark.style('default') @pytest.mark.backend('pgf') +======= +@switch_backend('pgf') +>>>>>>> 40d5e418e... FIX small nitpicks def test_rcupdate(): rc_sets = [] rc_sets.append({'font.family': 'sans-serif', @@ -145,9 +157,13 @@ def test_rcupdate(): # test backend-side clipping, since large numbers are not supported by TeX +<<<<<<< HEAD @needs_xelatex @pytest.mark.style('default') @pytest.mark.backend('pgf') +======= +@switch_backend('pgf') +>>>>>>> 40d5e418e... FIX small nitpicks def test_pathclip(): rc_xelatex = {'font.family': 'serif', 'pgf.rcfonts': False} @@ -162,9 +178,13 @@ def test_pathclip(): # test mixed mode rendering +<<<<<<< HEAD @needs_xelatex @pytest.mark.style('default') @pytest.mark.backend('pgf') +======= +@switch_backend('pgf') +>>>>>>> 40d5e418e... FIX small nitpicks def test_mixedmode(): rc_xelatex = {'font.family': 'serif', 'pgf.rcfonts': False} @@ -177,9 +197,13 @@ def test_mixedmode(): # test bbox_inches clipping +<<<<<<< HEAD @needs_xelatex @pytest.mark.style('default') @pytest.mark.backend('pgf') +======= +@switch_backend('pgf') +>>>>>>> 40d5e418e... FIX small nitpicks def test_bbox_inches(): rc_xelatex = {'font.family': 'serif', 'pgf.rcfonts': False}