@@ -2772,19 +2772,64 @@ def __call__(self, x=None, y=None, kind='line', ax=None,
2772
2772
2773
2773
def line (self , x = None , y = None , ** kwds ):
2774
2774
"""
2775
- Line plot
2775
+ Plot DataFrame columns as lines.
2776
+
2777
+ This function is useful to plot lines using DataFrame's values
2778
+ as coordinates.
2776
2779
2777
2780
Parameters
2778
2781
----------
2779
- x, y : label or position, optional
2780
- Coordinates for each point.
2781
- `**kwds` : optional
2782
- Additional keyword arguments are documented in
2783
- :meth:`pandas.DataFrame.plot`.
2782
+ x : int or str, optional
2783
+ Columns to use for the horizontal axis.
2784
+ Either the location or the label of the columns to be used.
2785
+ By default, it will use the DataFrame indices.
2786
+ y : int, str, or list of them, optional
2787
+ The values to be plotted.
2788
+ Either the location or the label of the columns to be used.
2789
+ By default, it will use the remaining DataFrame numeric columns.
2790
+ **kwds
2791
+ Keyword arguments to pass on to :meth:`pandas.DataFrame.plot`.
2784
2792
2785
2793
Returns
2786
2794
-------
2787
- axes : :class:`matplotlib.axes.Axes` or numpy.ndarray of them
2795
+ axes : :class:`matplotlib.axes.Axes` or :class:`numpy.ndarray`
2796
+ Returns an ndarray when ``subplots=True``.
2797
+
2798
+ See Also
2799
+ --------
2800
+ matplotlib.pyplot.plot : Plot y versus x as lines and/or markers.
2801
+
2802
+ Examples
2803
+ --------
2804
+
2805
+ .. plot::
2806
+ :context: close-figs
2807
+
2808
+ The following example shows the populations for some animals
2809
+ over the years.
2810
+
2811
+ >>> df = pd.DataFrame({
2812
+ ... 'pig': [20, 18, 489, 675, 1776],
2813
+ ... 'horse': [4, 25, 281, 600, 1900]
2814
+ ... }, index=[1990, 1997, 2003, 2009, 2014])
2815
+ >>> lines = df.plot.line()
2816
+
2817
+ .. plot::
2818
+ :context: close-figs
2819
+
2820
+ An example with subplots, so an array of axes is returned.
2821
+
2822
+ >>> axes = df.plot.line(subplots=True)
2823
+ >>> type(axes)
2824
+ <class 'numpy.ndarray'>
2825
+
2826
+ .. plot::
2827
+ :context: close-figs
2828
+
2829
+ The following example shows the relationship between both
2830
+ populations.
2831
+
2832
+ >>> lines = df.plot.line(x='pig', y='horse')
2788
2833
"""
2789
2834
return self (kind = 'line' , x = x , y = y , ** kwds )
2790
2835
0 commit comments