diff --git a/doc/source/visualization.rst b/doc/source/visualization.rst index ce3c335b431ad..23207a0e11a65 100644 --- a/doc/source/visualization.rst +++ b/doc/source/visualization.rst @@ -26,7 +26,7 @@ libraries that go beyond the basics documented here. Basic Plotting: ``plot`` ------------------------ -We will demonstrate the basics, see the :ref:`cookbook` for +We will demonstrate the basics, see the :ref:`cookbook` for some advanced strategies. The ``plot`` method on Series and DataFrame is just a simple wrapper around @@ -87,7 +87,7 @@ You can plot one column versus another using the `x` and `y` keywords in .. note:: - For more formatting and styling options, see + For more formatting and styling options, see :ref:`formatting ` below. .. ipython:: python @@ -129,7 +129,7 @@ You can also create these other plots using the methods ``DataFrame.plot.` In [14]: df = pd.DataFrame() - In [15]: df.plot. + In [15]: df.plot. # noqa: E225, E999 df.plot.area df.plot.barh df.plot.density df.plot.hist df.plot.line df.plot.scatter df.plot.bar df.plot.box df.plot.hexbin df.plot.kde df.plot.pie @@ -163,7 +163,8 @@ For labeled, non-time series data, you may wish to produce a bar plot: plt.figure(); @savefig bar_plot_ex.png - df.iloc[5].plot.bar(); plt.axhline(0, color='k') + df.iloc[5].plot.bar() + plt.axhline(0, color='k'); Calling a DataFrame's :meth:`plot.bar() ` method produces a multiple bar plot: @@ -231,7 +232,7 @@ Histograms can be drawn by using the :meth:`DataFrame.plot.hist` and :meth:`Seri plt.close('all') -A histogram can be stacked using ``stacked=True``. Bin size can be changed +A histogram can be stacked using ``stacked=True``. Bin size can be changed using the ``bins`` keyword. .. ipython:: python @@ -246,8 +247,8 @@ using the ``bins`` keyword. plt.close('all') -You can pass other keywords supported by matplotlib ``hist``. For example, -horizontal and cumulative histograms can be drawn by +You can pass other keywords supported by matplotlib ``hist``. For example, +horizontal and cumulative histograms can be drawn by ``orientation='horizontal'`` and ``cumulative=True``. .. ipython:: python @@ -477,7 +478,7 @@ keyword, will affect the output type as well: plt.close('all') -The subplots above are split by the numeric columns first, then the value of +The subplots above are split by the numeric columns first, then the value of the ``g`` column. Below the subplots are first split by the value of ``g``, then by the numeric columns. @@ -579,8 +580,8 @@ each point: plt.close('all') -You can pass other keywords supported by matplotlib -:meth:`scatter `. The example below shows a +You can pass other keywords supported by matplotlib +:meth:`scatter `. The example below shows a bubble chart using a column of the ``DataFrame`` as the bubble size. .. ipython:: python @@ -684,15 +685,15 @@ A ``ValueError`` will be raised if there are any negative values in your data. plt.close('all') -For pie plots it's best to use square figures, i.e. a figure aspect ratio 1. -You can create the figure with equal width and height, or force the aspect ratio -to be equal after plotting by calling ``ax.set_aspect('equal')`` on the returned +For pie plots it's best to use square figures, i.e. a figure aspect ratio 1. +You can create the figure with equal width and height, or force the aspect ratio +to be equal after plotting by calling ``ax.set_aspect('equal')`` on the returned ``axes`` object. -Note that pie plot with :class:`DataFrame` requires that you either specify a -target column by the ``y`` argument or ``subplots=True``. When ``y`` is -specified, pie plot of selected column will be drawn. If ``subplots=True`` is -specified, pie plots for each column are drawn as subplots. A legend will be +Note that pie plot with :class:`DataFrame` requires that you either specify a +target column by the ``y`` argument or ``subplots=True``. When ``y`` is +specified, pie plot of selected column will be drawn. If ``subplots=True`` is +specified, pie plots for each column are drawn as subplots. A legend will be drawn in each pie plots by default; specify ``legend=False`` to hide it. .. ipython:: python @@ -918,7 +919,7 @@ Lag Plot Lag plots are used to check if a data set or time series is random. Random data should not exhibit any structure in the lag plot. Non-random structure implies that the underlying data are not random. The ``lag`` argument may -be passed, and when ``lag=1`` the plot is essentially ``data[:-1]`` vs. +be passed, and when ``lag=1`` the plot is essentially ``data[:-1]`` vs. ``data[1:]``. .. ipython:: python @@ -954,7 +955,7 @@ If time series is random, such autocorrelations should be near zero for any and all time-lag separations. If time series is non-random then one or more of the autocorrelations will be significantly non-zero. The horizontal lines displayed in the plot correspond to 95% and 99% confidence bands. The dashed line is 99% -confidence band. See the +confidence band. See the `Wikipedia entry `__ for more about autocorrelation plots. @@ -1446,9 +1447,9 @@ Plotting with matplotlib table is now supported in :meth:`DataFrame.plot` and : plt.close('all') -Also, you can pass a different :class:`DataFrame` or :class:`Series` to the -``table`` keyword. The data will be drawn as displayed in print method -(not transposed automatically). If required, it should be transposed manually +Also, you can pass a different :class:`DataFrame` or :class:`Series` to the +``table`` keyword. The data will be drawn as displayed in print method +(not transposed automatically). If required, it should be transposed manually as seen in the example below. .. ipython:: python @@ -1463,9 +1464,9 @@ as seen in the example below. plt.close('all') -There also exists a helper function ``pandas.plotting.table``, which creates a -table from :class:`DataFrame` or :class:`Series`, and adds it to an -``matplotlib.Axes`` instance. This function can accept keywords which the +There also exists a helper function ``pandas.plotting.table``, which creates a +table from :class:`DataFrame` or :class:`Series`, and adds it to an +``matplotlib.Axes`` instance. This function can accept keywords which the matplotlib `table `__ has. .. ipython:: python @@ -1597,8 +1598,8 @@ Plotting directly with matplotlib In some situations it may still be preferable or necessary to prepare plots directly with matplotlib, for instance when a certain type of plot or -customization is not (yet) supported by pandas. ``Series`` and ``DataFrame`` -objects behave like arrays and can therefore be passed directly to +customization is not (yet) supported by pandas. ``Series`` and ``DataFrame`` +objects behave like arrays and can therefore be passed directly to matplotlib functions without explicit casts. pandas also automatically registers formatters and locators that recognize date diff --git a/setup.cfg b/setup.cfg index 73a3a6c136b53..19109e5c62f63 100644 --- a/setup.cfg +++ b/setup.cfg @@ -88,7 +88,6 @@ exclude = doc/source/options.rst doc/source/release.rst doc/source/reshaping.rst - doc/source/visualization.rst [yapf]