@@ -2704,18 +2704,55 @@ def __call__(self, x=None, y=None, kind='line', ax=None,
2704
2704
2705
2705
def line (self , x = None , y = None , ** kwds ):
2706
2706
"""
2707
- Line plot
2707
+ Plot DataFrame columns as lines.
2708
+
2709
+ This function is useful to plot lines using DataFrame's values
2710
+ as coordinates.
2708
2711
2709
2712
Parameters
2710
2713
----------
2711
- x, y : label or position, optional
2712
- Coordinates for each point.
2713
- `**kwds` : optional
2714
- Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
2714
+ x : int or str, optional
2715
+ Columns to use for the horizontal axis.
2716
+ Either the location or the label of the columns to be used.
2717
+ By default, it will use the `DataFrame` indices.
2718
+ y : int, str, or list of them, optional
2719
+ The values to be plotted.
2720
+ Either the location or the label of the columns to be used.
2721
+ By default, it will use the remaining DataFrame numeric columns.
2722
+ kwds : optional
2723
+ Keyword arguments to pass on to :py:meth:pandas.DataFrame.plot.
2715
2724
2716
2725
Returns
2717
2726
-------
2718
- axes : matplotlib.AxesSubplot or np.array of them
2727
+ axes : :class:matplotlib.AxesSubplot or :class:numpy.ndarray of
2728
+ them.
2729
+
2730
+ See Also
2731
+ --------
2732
+ matplotlib.pyplot.plot : Plot y versus x as lines and/or markers.
2733
+
2734
+ Examples
2735
+ --------
2736
+
2737
+ .. plot::
2738
+ :context: close-figs
2739
+
2740
+ The following example shows the populations for some animals
2741
+ over the years.
2742
+
2743
+ >>> df = pd.DataFrame({
2744
+ ... 'pig': [20, 18, 489, 675, 1776],
2745
+ ... 'horse': [4, 25, 281, 600, 1900]
2746
+ ... }, index=[1990, 1997, 2003, 2009, 2014])
2747
+ >>> lines = df.plot.line()
2748
+
2749
+ .. plot::
2750
+ :context: close-figs
2751
+
2752
+ The following example shows the relationship between both
2753
+ populations.
2754
+
2755
+ >>> lines = df.plot.line(x='pig', y='horse')
2719
2756
"""
2720
2757
return self (kind = 'line' , x = x , y = y , ** kwds )
2721
2758
0 commit comments