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