@@ -103,6 +103,16 @@ def hist_series(
103
103
104
104
Examples
105
105
--------
106
+ For Series:
107
+
108
+ .. plot::
109
+ :context: close-figs
110
+
111
+ >>> lst = ['a', 'a', 'a', 'b', 'b', 'b']
112
+ >>> ser = pd.Series([1, 2, 2, 4, 6, 6], index=lst)
113
+ >>> hist = ser.hist()
114
+
115
+ For Groupby:
106
116
107
117
.. plot::
108
118
:context: close-figs
@@ -790,23 +800,41 @@ class PlotAccessor(PandasObject):
790
800
791
801
Examples
792
802
--------
793
- For SeriesGroupBy :
803
+ For Series :
794
804
795
805
.. plot::
796
806
:context: close-figs
797
807
798
808
>>> ser = pd.Series([1, 2, 3, 3])
799
809
>>> plot = ser.plot(kind='hist', title="My plot")
800
810
801
- For DataFrameGroupBy :
811
+ For DataFrame :
802
812
803
813
.. plot::
804
814
:context: close-figs
805
815
806
816
>>> df = pd.DataFrame({'length': [1.5, 0.5, 1.2, 0.9, 3],
807
817
... 'width': [0.7, 0.2, 0.15, 0.2, 1.1]},
808
818
... index=['pig', 'rabbit', 'duck', 'chicken', 'horse'])
809
- >>> plot = df.plot()
819
+ >>> plot = df.plot(title="DataFrame Plot")
820
+
821
+ For SeriesGroupBy:
822
+
823
+ .. plot::
824
+ :context: close-figs
825
+
826
+ >>> lst = [-1, -2, -3, 1, 2, 3]
827
+ >>> ser = pd.Series([1, 2, 2, 4, 6, 6], index=lst)
828
+ >>> plot = ser.groupby(lambda x: x > 0).plot(title="SeriesGroupBy Plot")
829
+
830
+ For DataFrameGroupBy:
831
+
832
+ .. plot::
833
+ :context: close-figs
834
+
835
+ >>> df = pd.DataFrame({"col1" : [1, 2, 3, 4],
836
+ ... "col2" : ["A", "B", "A", "B"]})
837
+ >>> plot = df.groupby("col2").plot(kind="bar", title="DataFrameGroupBy Plot")
810
838
"""
811
839
812
840
_common_kinds = ("line" , "bar" , "barh" , "kde" , "density" , "area" , "hist" , "box" )
0 commit comments