@@ -386,6 +386,45 @@ def hist_frame(
386386"""
387387
388388
389+ _bar_or_line_doc = """\
390+ Parameters
391+ ----------
392+ x : label or position, optional
393+ Allows plotting of one column versus another. If not specified,
394+ the index of the DataFrame is used.
395+ y : label or position, optional
396+ Allows plotting of one column versus another. If not specified,
397+ all numerical columns are used.
398+ color : str, array_like, or dict, optional
399+ The color for each of the DataFrame's columns. Possible values are:
400+
401+ - A single color string referred to by name, RGB or RGBA code,
402+ for instance 'red' or '#a98d19'.
403+
404+ - A sequence of color strings referred to by name, RGB or RGBA
405+ code, which will be used for each column recursively. For
406+ instance ['green','yellow'] each column's %(kind)s will be filled in
407+ green or yellow, alternatively.
408+
409+ - A dict of the form {column name : color}, so that each column will be
410+ colored accordingly. For example, if your columns are called `a` and `b`,
411+ then passing {'a': 'green', 'b': 'red'} will color %(kind)ss for column `a` in
412+ green and %(kind)ss for column `b` in red.
413+
414+ .. versionadded:: 1.1.0
415+
416+ **kwargs
417+ Additional keyword arguments are documented in
418+ :meth:`DataFrame.plot`.
419+
420+ Returns
421+ -------
422+ matplotlib.axes.Axes or np.ndarray of them
423+ An ndarray is returned with one :class:`matplotlib.axes.Axes`
424+ per column when ``subplots=True``.
425+ """
426+
427+
389428@Substitution (backend = "" )
390429@Appender (_boxplot_doc )
391430def boxplot (
@@ -847,46 +886,8 @@ def __call__(self, *args, **kwargs):
847886
848887 return plot_backend .plot (data , kind = kind , ** kwargs )
849888
850- def line ( self , x = None , y = None , ** kwargs ):
889+ @ Appender (
851890 """
852- Plot Series or DataFrame as lines.
853-
854- This function is useful to plot lines using DataFrame's values
855- as coordinates.
856-
857- Parameters
858- ----------
859- x : int or str, optional
860- Columns to use for the horizontal axis.
861- Either the location or the label of the columns to be used.
862- By default, it will use the DataFrame indices.
863- y : int, str, or list of them, optional
864- The values to be plotted.
865- Either the location or the label of the columns to be used.
866- By default, it will use the remaining DataFrame numeric columns.
867- color : str, int, array_like, or dict, optional
868- The color for each of the DataFrame's columns. Possible values are:
869-
870- - A single color string referred to by name, RGB or RGBA code,
871- for instance 'red' or '#a98d19'.
872-
873- - A sequence of color strings referred to by name, RGB or RGBA
874- code, which will be used for each column recursively. For
875- instance ['green','yellow'] each column's line will be coloured in
876- green or yellow, alternatively.
877-
878- - A dict of the form {column name : color}, so that each column will be
879- colored accordingly. For example, if your columns are called `a` and `b`,
880- then passing {'a': 'green', 'b': 'red'} will color lines for column `a` in
881- green and lines for column `b` in red.
882- **kwargs
883- Keyword arguments to pass on to :meth:`DataFrame.plot`.
884-
885- Returns
886- -------
887- :class:`matplotlib.axes.Axes` or :class:`numpy.ndarray`
888- Return an ndarray when ``subplots=True``.
889-
890891 See Also
891892 --------
892893 matplotlib.pyplot.plot : Plot y versus x as lines and/or markers.
@@ -939,51 +940,21 @@ def line(self, x=None, y=None, **kwargs):
939940
940941 >>> lines = df.plot.line(x='pig', y='horse')
941942 """
942- return self (kind = "line" , x = x , y = y , ** kwargs )
943-
944- def bar (self , x = None , y = None , ** kwargs ):
943+ )
944+ @Substitution (kind = "line" )
945+ @Appender (_bar_or_line_doc )
946+ def line (self , x = None , y = None , ** kwargs ):
945947 """
946- Vertical bar plot.
947-
948- A bar plot is a plot that presents categorical data with
949- rectangular bars with lengths proportional to the values that they
950- represent. A bar plot shows comparisons among discrete categories. One
951- axis of the plot shows the specific categories being compared, and the
952- other axis represents a measured value.
953-
954- Parameters
955- ----------
956- x : label or position, optional
957- Allows plotting of one column versus another. If not specified,
958- the index of the DataFrame is used.
959- y : label or position, optional
960- Allows plotting of one column versus another. If not specified,
961- all numerical columns are used.
962- color : str, int, array_like, or dict, optional
963- The color for each of the DataFrame's columns. Possible values are:
964-
965- - A single color string referred to by name, RGB or RGBA code,
966- for instance 'red' or '#a98d19'.
948+ Plot Series or DataFrame as lines.
967949
968- - A sequence of color strings referred to by name, RGB or RGBA
969- code, which will be used for each column recursively. For
970- instance ['green','yellow'] each column's bar will be filled in
971- green or yellow, alternatively.
972-
973- - A dict of the form {column name : color}, so that each column will be
974- colored accordingly. For example, if your columns are called `a` and `b`,
975- then passing {'a': 'green', 'b': 'red'} will color bars for column `a` in
976- green and bars for column `b` in red.
977- **kwargs
978- Additional keyword arguments are documented in
979- :meth:`DataFrame.plot`.
950+ This function is useful to plot lines using DataFrame's values
951+ as coordinates.
980952
981- Returns
982- -------
983- matplotlib.axes.Axes or np.ndarray of them
984- An ndarray is returned with one :class:`matplotlib.axes.Axes`
985- per column when ``subplots=True``.
953+ """
954+ return self (kind = "line" , x = x , y = y , ** kwargs )
986955
956+ @Appender (
957+ """
987958 See Also
988959 --------
989960 DataFrame.plot.barh : Horizontal bar plot.
@@ -1049,47 +1020,25 @@ def bar(self, x=None, y=None, **kwargs):
10491020 :context: close-figs
10501021
10511022 >>> 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 ):
10521028 """
1053- return self (kind = "bar" , x = x , y = y , ** kwargs )
1054-
1055- def barh (self , x = None , y = None , ** kwargs ):
1056- """
1057- Make a horizontal bar plot.
1029+ Vertical bar plot.
10581030
1059- A horizontal bar plot is a plot that presents quantitative data with
1031+ A bar plot is a plot that presents categorical data with
10601032 rectangular bars with lengths proportional to the values that they
10611033 represent. A bar plot shows comparisons among discrete categories. One
10621034 axis of the plot shows the specific categories being compared, and the
10631035 other axis represents a measured value.
10641036
1065- Parameters
1066- ----------
1067- x : label or position, default DataFrame.index
1068- Column to be used for categories.
1069- y : label or position, default All numeric columns in dataframe
1070- Columns to be plotted from the DataFrame.
1071- color : str, int, array_like, or dict, optional
1072- The color for each of the DataFrame's columns. Possible values are:
1073-
1074- - A single color string referred to by name, RGB or RGBA code,
1075- for instance 'red' or '#a98d19'.
1076-
1077- - A sequence of color strings referred to by name, RGB or RGBA
1078- code, which will be used for each column recursively. For
1079- instance ['green','yellow'] each column's bar will be filled in
1080- green or yellow, alternatively.
1081-
1082- - A dict of the form {column name : color}, so that each column will be
1083- colored accordingly. For example, if your columns are called `a` and `b`,
1084- then passing {'a': 'green', 'b': 'red'} will color bars for column `a` in
1085- green and bars for column `b` in red.
1086- **kwargs
1087- Keyword arguments to pass on to :meth:`DataFrame.plot`.
1088-
1089- Returns
1090- -------
1091- :class:`matplotlib.axes.Axes` or numpy.ndarray of them
1037+ """
1038+ return self (kind = "bar" , x = x , y = y , ** kwargs )
10921039
1040+ @Appender (
1041+ """
10931042 See Also
10941043 --------
10951044 DataFrame.plot.bar: Vertical bar plot.
@@ -1151,6 +1100,20 @@ def barh(self, x=None, y=None, **kwargs):
11511100 >>> df = pd.DataFrame({'speed': speed,
11521101 ... 'lifespan': lifespan}, index=index)
11531102 >>> ax = df.plot.barh(x='lifespan')
1103+ """
1104+ )
1105+ @Substitution (kind = "bar" )
1106+ @Appender (_bar_or_line_doc )
1107+ def barh (self , x = None , y = None , ** kwargs ):
1108+ """
1109+ Make a horizontal bar plot.
1110+
1111+ A horizontal bar plot is a plot that presents quantitative data with
1112+ rectangular bars with lengths proportional to the values that they
1113+ represent. A bar plot shows comparisons among discrete categories. One
1114+ axis of the plot shows the specific categories being compared, and the
1115+ other axis represents a measured value.
1116+
11541117 """
11551118 return self (kind = "barh" , x = x , y = y , ** kwargs )
11561119
0 commit comments