@@ -385,6 +385,45 @@ def hist_frame(
385385"""
386386
387387
388+ _bar_or_line_doc = """
389+ Parameters
390+ ----------
391+ x : label or position, optional
392+ Allows plotting of one column versus another. If not specified,
393+ the index of the DataFrame is used.
394+ y : label or position, optional
395+ Allows plotting of one column versus another. If not specified,
396+ all numerical columns are used.
397+ color : str, array_like, or dict, optional
398+ The color for each of the DataFrame's columns. Possible values are:
399+
400+ - A single color string referred to by name, RGB or RGBA code,
401+ for instance 'red' or '#a98d19'.
402+
403+ - A sequence of color strings referred to by name, RGB or RGBA
404+ code, which will be used for each column recursively. For
405+ instance ['green','yellow'] each column's %(kind)s will be filled in
406+ green or yellow, alternatively.
407+
408+ - A dict of the form {column name : color}, so that each column will be
409+ colored accordingly. For example, if your columns are called `a` and
410+ `b`, then passing {'a': 'green', 'b': 'red'} will color %(kind)ss for
411+ column `a` in green and %(kind)ss for column `b` in red.
412+
413+ .. versionadded:: 1.1.0
414+
415+ **kwargs
416+ Additional keyword arguments are documented in
417+ :meth:`DataFrame.plot`.
418+
419+ Returns
420+ -------
421+ matplotlib.axes.Axes or np.ndarray of them
422+ An ndarray is returned with one :class:`matplotlib.axes.Axes`
423+ per column when ``subplots=True``.
424+ """
425+
426+
388427@Substitution (backend = "" )
389428@Appender (_boxplot_doc )
390429def boxplot (
@@ -848,46 +887,8 @@ def __call__(self, *args, **kwargs):
848887
849888 __call__ .__doc__ = __doc__
850889
851- def line ( self , x = None , y = None , ** kwargs ):
890+ @ Appender (
852891 """
853- Plot Series or DataFrame as lines.
854-
855- This function is useful to plot lines using DataFrame's values
856- as coordinates.
857-
858- Parameters
859- ----------
860- x : int or str, optional
861- Columns to use for the horizontal axis.
862- Either the location or the label of the columns to be used.
863- By default, it will use the DataFrame indices.
864- y : int, str, or list of them, optional
865- The values to be plotted.
866- Either the location or the label of the columns to be used.
867- By default, it will use the remaining DataFrame numeric columns.
868- color : str, int, array_like, or dict, optional
869- The color for each of the DataFrame's columns. Possible values are:
870-
871- - A single color string referred to by name, RGB or RGBA code,
872- for instance 'red' or '#a98d19'.
873-
874- - A sequence of color strings referred to by name, RGB or RGBA
875- code, which will be used for each column recursively. For
876- instance ['green','yellow'] each column's line will be coloured in
877- green or yellow, alternatively.
878-
879- - A dict of the form {column name : color}, so that each column will be
880- colored accordingly. For example, if your columns are called `a` and `b`,
881- then passing {'a': 'green', 'b': 'red'} will color lines for column `a` in
882- green and lines for column `b` in red.
883- **kwargs
884- Keyword arguments to pass on to :meth:`DataFrame.plot`.
885-
886- Returns
887- -------
888- :class:`matplotlib.axes.Axes` or :class:`numpy.ndarray`
889- Return an ndarray when ``subplots=True``.
890-
891892 See Also
892893 --------
893894 matplotlib.pyplot.plot : Plot y versus x as lines and/or markers.
@@ -940,51 +941,20 @@ def line(self, x=None, y=None, **kwargs):
940941
941942 >>> lines = df.plot.line(x='pig', y='horse')
942943 """
943- return self (kind = "line" , x = x , y = y , ** kwargs )
944-
945- def bar (self , x = None , y = None , ** kwargs ):
944+ )
945+ @Substitution (kind = "line" )
946+ @Appender (_bar_or_line_doc )
947+ def line (self , x = None , y = None , ** kwargs ):
946948 """
947- Vertical bar plot.
948-
949- A bar plot is a plot that presents categorical data with
950- rectangular bars with lengths proportional to the values that they
951- represent. A bar plot shows comparisons among discrete categories. One
952- axis of the plot shows the specific categories being compared, and the
953- other axis represents a measured value.
954-
955- Parameters
956- ----------
957- x : label or position, optional
958- Allows plotting of one column versus another. If not specified,
959- the index of the DataFrame is used.
960- y : label or position, optional
961- Allows plotting of one column versus another. If not specified,
962- all numerical columns are used.
963- color : str, int, array_like, or dict, optional
964- The color for each of the DataFrame's columns. Possible values are:
965-
966- - A single color string referred to by name, RGB or RGBA code,
967- for instance 'red' or '#a98d19'.
968-
969- - A sequence of color strings referred to by name, RGB or RGBA
970- code, which will be used for each column recursively. For
971- instance ['green','yellow'] each column's bar will be filled in
972- green or yellow, alternatively.
973-
974- - A dict of the form {column name : color}, so that each column will be
975- colored accordingly. For example, if your columns are called `a` and `b`,
976- then passing {'a': 'green', 'b': 'red'} will color bars for column `a` in
977- green and bars for column `b` in red.
978- **kwargs
979- Additional keyword arguments are documented in
980- :meth:`DataFrame.plot`.
949+ Plot Series or DataFrame as lines.
981950
982- Returns
983- -------
984- matplotlib.axes.Axes or np.ndarray of them
985- An ndarray is returned with one :class:`matplotlib.axes.Axes`
986- per column when ``subplots=True``.
951+ This function is useful to plot lines using DataFrame's values
952+ as coordinates.
953+ """
954+ return self (kind = "line" , x = x , y = y , ** kwargs )
987955
956+ @Appender (
957+ """
988958 See Also
989959 --------
990960 DataFrame.plot.barh : Horizontal bar plot.
@@ -1050,47 +1020,24 @@ def bar(self, x=None, y=None, **kwargs):
10501020 :context: close-figs
10511021
10521022 >>> ax = df.plot.bar(x='lifespan', rot=0)
1023+ """
1024+ )
1025+ @Substitution (kind = "bar" )
1026+ @Appender (_bar_or_line_doc )
1027+ def bar (self , x = None , y = None , ** kwargs ):
10531028 """
1054- return self (kind = "bar" , x = x , y = y , ** kwargs )
1055-
1056- def barh (self , x = None , y = None , ** kwargs ):
1057- """
1058- Make a horizontal bar plot.
1029+ Vertical bar plot.
10591030
1060- A horizontal bar plot is a plot that presents quantitative data with
1031+ A bar plot is a plot that presents categorical data with
10611032 rectangular bars with lengths proportional to the values that they
10621033 represent. A bar plot shows comparisons among discrete categories. One
10631034 axis of the plot shows the specific categories being compared, and the
10641035 other axis represents a measured value.
1036+ """
1037+ return self (kind = "bar" , x = x , y = y , ** kwargs )
10651038
1066- Parameters
1067- ----------
1068- x : label or position, default DataFrame.index
1069- Column to be used for categories.
1070- y : label or position, default All numeric columns in dataframe
1071- Columns to be plotted from the DataFrame.
1072- color : str, int, array_like, or dict, optional
1073- The color for each of the DataFrame's columns. Possible values are:
1074-
1075- - A single color string referred to by name, RGB or RGBA code,
1076- for instance 'red' or '#a98d19'.
1077-
1078- - A sequence of color strings referred to by name, RGB or RGBA
1079- code, which will be used for each column recursively. For
1080- instance ['green','yellow'] each column's bar will be filled in
1081- green or yellow, alternatively.
1082-
1083- - A dict of the form {column name : color}, so that each column will be
1084- colored accordingly. For example, if your columns are called `a` and `b`,
1085- then passing {'a': 'green', 'b': 'red'} will color bars for column `a` in
1086- green and bars for column `b` in red.
1087- **kwargs
1088- Keyword arguments to pass on to :meth:`DataFrame.plot`.
1089-
1090- Returns
1091- -------
1092- :class:`matplotlib.axes.Axes` or numpy.ndarray of them
1093-
1039+ @Appender (
1040+ """
10941041 See Also
10951042 --------
10961043 DataFrame.plot.bar: Vertical bar plot.
@@ -1152,6 +1099,19 @@ def barh(self, x=None, y=None, **kwargs):
11521099 >>> df = pd.DataFrame({'speed': speed,
11531100 ... 'lifespan': lifespan}, index=index)
11541101 >>> ax = df.plot.barh(x='lifespan')
1102+ """
1103+ )
1104+ @Substitution (kind = "bar" )
1105+ @Appender (_bar_or_line_doc )
1106+ def barh (self , x = None , y = None , ** kwargs ):
1107+ """
1108+ Make a horizontal bar plot.
1109+
1110+ A horizontal bar plot is a plot that presents quantitative data with
1111+ rectangular bars with lengths proportional to the values that they
1112+ represent. A bar plot shows comparisons among discrete categories. One
1113+ axis of the plot shows the specific categories being compared, and the
1114+ other axis represents a measured value.
11551115 """
11561116 return self (kind = "barh" , x = x , y = y , ** kwargs )
11571117
0 commit comments