@@ -621,7 +621,11 @@ A ``ValueError`` will be raised if there are any negative values in your data.
621
621
series = Series(3 * rand(4 ), index = [' a' , ' b' , ' c' , ' d' ], name = ' series' )
622
622
623
623
@savefig series_pie_plot.png
624
- series.plot(kind = ' pie' )
624
+ series.plot(kind = ' pie' , figsize = (6 , 6 ))
625
+
626
+ For pie plots it's best to use square figures, one's with an equal aspect ratio. You can create the
627
+ figure with equal width and height, or force the aspect ratio to be equal after plotting by
628
+ calling ``ax.set_aspect('equal') `` on the returned ``axes `` object.
625
629
626
630
Note that pie plot with :class: `DataFrame ` requires that you either specify a target column by the ``y ``
627
631
argument or ``subplots=True ``. When ``y `` is specified, pie plot of selected column
@@ -639,7 +643,7 @@ A legend will be drawn in each pie plots by default; specify ``legend=False`` to
639
643
df = DataFrame(3 * rand(4 , 2 ), index = [' a' , ' b' , ' c' , ' d' ], columns = [' x' , ' y' ])
640
644
641
645
@savefig df_pie_plot.png
642
- df.plot(kind = ' pie' , subplots = True )
646
+ df.plot(kind = ' pie' , subplots = True , figsize = ( 8 , 4 ) )
643
647
644
648
You can use the ``labels `` and ``colors `` keywords to specify the labels and colors of each wedge.
645
649
@@ -662,7 +666,7 @@ Also, other keywords supported by :func:`matplotlib.pyplot.pie` can be used.
662
666
663
667
@savefig series_pie_plot_options.png
664
668
series.plot(kind = ' pie' , labels = [' AA' , ' BB' , ' CC' , ' DD' ], colors = [' r' , ' g' , ' b' , ' c' ],
665
- autopct = ' %.2f ' , fontsize = 20 )
669
+ autopct = ' %.2f ' , fontsize = 20 , figsize = ( 6 , 6 ) )
666
670
667
671
If you pass values whose sum total is less than 1.0, matplotlib draws a semicircle.
668
672
@@ -676,7 +680,7 @@ If you pass values whose sum total is less than 1.0, matplotlib draws a semicirc
676
680
series = Series([0.1 ] * 4 , index = [' a' , ' b' , ' c' , ' d' ], name = ' series2' )
677
681
678
682
@savefig series_pie_plot_semi.png
679
- series.plot(kind = ' pie' )
683
+ series.plot(kind = ' pie' , figsize = ( 6 , 6 ) )
680
684
681
685
See the `matplotlib pie documenation <http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie >`__ for more.
682
686
@@ -1113,16 +1117,16 @@ or columns needed, given the other.
1113
1117
.. ipython :: python
1114
1118
1115
1119
@savefig frame_plot_subplots_layout.png
1116
- df.plot(subplots = True , layout = (2 , 3 ), figsize = (6 , 6 ));
1120
+ df.plot(subplots = True , layout = (3 , 2 ), figsize = (6 , 6 ), sharex = False );
1117
1121
1118
1122
The above example is identical to using
1119
1123
1120
1124
.. ipython :: python
1121
1125
1122
- df.plot(subplots = True , layout = (- 1 , 3 ), figsize = (6 , 6 ));
1126
+ df.plot(subplots = True , layout = (3 , - 1 ), figsize = (6 , 6 ), sharex = False );
1123
1127
1124
- The required number of rows (2) is inferred from the number of series to plot
1125
- and the given number of columns (3).
1128
+ The required number of columns (2) is inferred from the number of series to plot
1129
+ and the given number of rows (3).
1126
1130
1127
1131
Also, you can pass multiple axes created beforehand as list-like via ``ax `` keyword.
1128
1132
This allows to use more complicated layout.
0 commit comments