From a16c5f02570b0528cc1efed7770a07054cb2aaba Mon Sep 17 00:00:00 2001 From: partev Date: Tue, 1 Sep 2020 11:45:28 -0400 Subject: [PATCH] Update visualization.rst add semicolons (";") after the plotting function to suppress unnecessary debug messages similar to: --- doc/source/user_guide/visualization.rst | 132 ++++++++++++------------ 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/doc/source/user_guide/visualization.rst b/doc/source/user_guide/visualization.rst index 8ce4b30c717a4..6e2e27e330a93 100644 --- a/doc/source/user_guide/visualization.rst +++ b/doc/source/user_guide/visualization.rst @@ -44,7 +44,7 @@ The ``plot`` method on Series and DataFrame is just a simple wrapper around ts = ts.cumsum() @savefig series_plot_basic.png - ts.plot() + ts.plot(); If the index consists of dates, it calls :meth:`gcf().autofmt_xdate() ` to try to format the x-axis nicely as per above. @@ -83,7 +83,7 @@ You can plot one column versus another using the `x` and `y` keywords in df3['A'] = pd.Series(list(range(len(df)))) @savefig df_plot_xy.png - df3.plot(x='A', y='B') + df3.plot(x='A', y='B'); .. note:: @@ -163,7 +163,7 @@ 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() + df.iloc[5].plot.bar(); plt.axhline(0, color='k'); Calling a DataFrame's :meth:`plot.bar() ` method produces a multiple @@ -224,7 +224,7 @@ Histograms can be drawn by using the :meth:`DataFrame.plot.hist` and :meth:`Seri plt.figure(); @savefig hist_new.png - df4.plot.hist(alpha=0.5) + df4.plot.hist(alpha=0.5); .. ipython:: python @@ -240,7 +240,7 @@ using the ``bins`` keyword. plt.figure(); @savefig hist_new_stacked.png - df4.plot.hist(stacked=True, bins=20) + df4.plot.hist(stacked=True, bins=20); .. ipython:: python :suppress: @@ -256,7 +256,7 @@ horizontal and cumulative histograms can be drawn by plt.figure(); @savefig hist_new_kwargs.png - df4['a'].plot.hist(orientation='horizontal', cumulative=True) + df4['a'].plot.hist(orientation='horizontal', cumulative=True); .. ipython:: python :suppress: @@ -274,7 +274,7 @@ The existing interface ``DataFrame.hist`` to plot histogram still can be used. plt.figure(); @savefig hist_plot_ex.png - df['A'].diff().hist() + df['A'].diff().hist(); .. ipython:: python :suppress: @@ -286,10 +286,10 @@ subplots: .. ipython:: python - plt.figure() + plt.figure(); @savefig frame_hist_ex.png - df.diff().hist(color='k', alpha=0.5, bins=50) + df.diff().hist(color='k', alpha=0.5, bins=50); The ``by`` keyword can be specified to plot grouped histograms: @@ -306,7 +306,7 @@ The ``by`` keyword can be specified to plot grouped histograms: data = pd.Series(np.random.randn(1000)) @savefig grouped_hist.png - data.hist(by=np.random.randint(0, 4, 1000), figsize=(6, 4)) + data.hist(by=np.random.randint(0, 4, 1000), figsize=(6, 4)); .. _visualization.box: @@ -331,7 +331,7 @@ a uniform random variable on [0,1). df = pd.DataFrame(np.random.rand(10, 5), columns=['A', 'B', 'C', 'D', 'E']) @savefig box_plot_new.png - df.plot.box() + df.plot.box(); Boxplot can be colorized by passing ``color`` keyword. You can pass a ``dict`` whose keys are ``boxes``, ``whiskers``, ``medians`` and ``caps``. @@ -352,7 +352,7 @@ more complicated colorization, you can get each drawn artists by passing 'medians': 'DarkBlue', 'caps': 'Gray'} @savefig box_new_colorize.png - df.plot.box(color=color, sym='r+') + df.plot.box(color=color, sym='r+'); .. ipython:: python :suppress: @@ -366,7 +366,7 @@ For example, horizontal and custom-positioned boxplot can be drawn by .. ipython:: python @savefig box_new_kwargs.png - df.plot.box(vert=False, positions=[1, 4, 5, 6, 8]) + df.plot.box(vert=False, positions=[1, 4, 5, 6, 8]); See the :meth:`boxplot ` method and the @@ -613,7 +613,7 @@ too dense to plot each point individually. df['b'] = df['b'] + np.arange(1000) @savefig hexbin_plot.png - df.plot.hexbin(x='a', y='b', gridsize=25) + df.plot.hexbin(x='a', y='b', gridsize=25); A useful keyword argument is ``gridsize``; it controls the number of hexagons @@ -642,7 +642,7 @@ given by column ``z``. The bins are aggregated with NumPy's ``max`` function. df['z'] = np.random.uniform(0, 3, 1000) @savefig hexbin_plot_agg.png - df.plot.hexbin(x='a', y='b', C='z', reduce_C_function=np.max, gridsize=25) + df.plot.hexbin(x='a', y='b', C='z', reduce_C_function=np.max, gridsize=25); .. ipython:: python :suppress: @@ -674,7 +674,7 @@ A ``ValueError`` will be raised if there are any negative values in your data. index=['a', 'b', 'c', 'd'], name='series') @savefig series_pie_plot.png - series.plot.pie(figsize=(6, 6)) + series.plot.pie(figsize=(6, 6)); .. ipython:: python :suppress: @@ -704,7 +704,7 @@ drawn in each pie plots by default; specify ``legend=False`` to hide it. index=['a', 'b', 'c', 'd'], columns=['x', 'y']) @savefig df_pie_plot.png - df.plot.pie(subplots=True, figsize=(8, 4)) + df.plot.pie(subplots=True, figsize=(8, 4)); .. ipython:: python :suppress: @@ -732,7 +732,7 @@ Also, other keywords supported by :func:`matplotlib.pyplot.pie` can be used. @savefig series_pie_plot_options.png series.plot.pie(labels=['AA', 'BB', 'CC', 'DD'], colors=['r', 'g', 'b', 'c'], - autopct='%.2f', fontsize=20, figsize=(6, 6)) + autopct='%.2f', fontsize=20, figsize=(6, 6)); If you pass values whose sum total is less than 1.0, matplotlib draws a semicircle. @@ -748,7 +748,7 @@ If you pass values whose sum total is less than 1.0, matplotlib draws a semicirc series = pd.Series([0.1] * 4, index=['a', 'b', 'c', 'd'], name='series2') @savefig series_pie_plot_semi.png - series.plot.pie(figsize=(6, 6)) + series.plot.pie(figsize=(6, 6)); See the `matplotlib pie documentation `__ for more. @@ -847,7 +847,7 @@ You can create density plots using the :meth:`Series.plot.kde` and :meth:`DataFr ser = pd.Series(np.random.randn(1000)) @savefig kde_plot.png - ser.plot.kde() + ser.plot.kde(); .. ipython:: python :suppress: @@ -874,10 +874,10 @@ of the same class will usually be closer together and form larger structures. data = pd.read_csv('data/iris.data') - plt.figure() + plt.figure(); @savefig andrews_curves.png - andrews_curves(data, 'Name') + andrews_curves(data, 'Name'); .. _visualization.parallel_coordinates: @@ -898,10 +898,10 @@ represents one data point. Points that tend to cluster will appear closer togeth data = pd.read_csv('data/iris.data') - plt.figure() + plt.figure(); @savefig parallel_coordinates.png - parallel_coordinates(data, 'Name') + parallel_coordinates(data, 'Name'); .. ipython:: python :suppress: @@ -928,13 +928,13 @@ be passed, and when ``lag=1`` the plot is essentially ``data[:-1]`` vs. from pandas.plotting import lag_plot - plt.figure() + plt.figure(); spacing = np.linspace(-99 * np.pi, 99 * np.pi, num=1000) data = pd.Series(0.1 * np.random.rand(1000) + 0.9 * np.sin(spacing)) @savefig lag_plot.png - lag_plot(data) + lag_plot(data); .. ipython:: python :suppress: @@ -965,13 +965,13 @@ autocorrelation plots. from pandas.plotting import autocorrelation_plot - plt.figure() + plt.figure(); spacing = np.linspace(-9 * np.pi, 9 * np.pi, num=1000) data = pd.Series(0.7 * np.random.rand(1000) + 0.3 * np.sin(spacing)) @savefig autocorrelation_plot.png - autocorrelation_plot(data) + autocorrelation_plot(data); .. ipython:: python :suppress: @@ -1001,7 +1001,7 @@ are what constitutes the bootstrap plot. data = pd.Series(np.random.rand(1000)) @savefig bootstrap_plot.png - bootstrap_plot(data, size=50, samples=500, color='grey') + bootstrap_plot(data, size=50, samples=500, color='grey'); .. ipython:: python :suppress: @@ -1034,10 +1034,10 @@ for more information. data = pd.read_csv('data/iris.data') - plt.figure() + plt.figure(); @savefig radviz.png - radviz(data, 'Name') + radviz(data, 'Name'); .. ipython:: python :suppress: @@ -1103,7 +1103,7 @@ shown by default. df = df.cumsum() @savefig frame_plot_basic_noleg.png - df.plot(legend=False) + df.plot(legend=False); .. ipython:: python :suppress: @@ -1123,11 +1123,11 @@ it empty for ylabel. .. ipython:: python :suppress: - plt.figure() + plt.figure(); .. ipython:: python - df.plot() + df.plot(); @savefig plot_xlabel_ylabel.png df.plot(xlabel="new x", ylabel="new y") @@ -1156,7 +1156,7 @@ You may pass ``logy`` to get a log-scale Y axis. ts = np.exp(ts.cumsum()) @savefig series_plot_logy.png - ts.plot(logy=True) + ts.plot(logy=True); .. ipython:: python :suppress: @@ -1177,10 +1177,10 @@ To plot data on a secondary y-axis, use the ``secondary_y`` keyword: .. ipython:: python - df['A'].plot() + df['A'].plot(); @savefig series_plot_secondary_y.png - df['B'].plot(secondary_y=True, style='g') + df['B'].plot(secondary_y=True, style='g'); .. ipython:: python :suppress: @@ -1192,11 +1192,11 @@ keyword: .. ipython:: python - plt.figure() + plt.figure(); ax = df.plot(secondary_y=['A', 'B']) - ax.set_ylabel('CD scale') + ax.set_ylabel('CD scale'); @savefig frame_plot_secondary_y.png - ax.right_ax.set_ylabel('AB scale') + ax.right_ax.set_ylabel('AB scale'); .. ipython:: python :suppress: @@ -1209,10 +1209,10 @@ with "(right)" in the legend. To turn off the automatic marking, use the .. ipython:: python - plt.figure() + plt.figure(); @savefig frame_plot_secondary_y_no_right.png - df.plot(secondary_y=['A', 'B'], mark_right=False) + df.plot(secondary_y=['A', 'B'], mark_right=False); .. ipython:: python :suppress: @@ -1246,10 +1246,10 @@ Here is the default behavior, notice how the x-axis tick labeling is performed: .. ipython:: python - plt.figure() + plt.figure(); @savefig ser_plot_suppress.png - df['A'].plot() + df['A'].plot(); .. ipython:: python :suppress: @@ -1260,10 +1260,10 @@ Using the ``x_compat`` parameter, you can suppress this behavior: .. ipython:: python - plt.figure() + plt.figure(); @savefig ser_plot_suppress_parm.png - df['A'].plot(x_compat=True) + df['A'].plot(x_compat=True); .. ipython:: python :suppress: @@ -1275,7 +1275,7 @@ in ``pandas.plotting.plot_params`` can be used in a `with statement`: .. ipython:: python - plt.figure() + plt.figure(); @savefig ser_plot_suppress_context.png with pd.plotting.plot_params.use('x_compat', True): @@ -1453,7 +1453,7 @@ Here is an example of one way to easily plot group means with standard deviation # Plot fig, ax = plt.subplots() @savefig errorbar_example.png - means.plot.bar(yerr=errors, ax=ax, capsize=4, rot=0) + means.plot.bar(yerr=errors, ax=ax, capsize=4, rot=0); .. ipython:: python :suppress: @@ -1479,7 +1479,7 @@ Plotting with matplotlib table is now supported in :meth:`DataFrame.plot` and : ax.xaxis.tick_top() # Display x-axis ticks on top. @savefig line_plot_table_true.png - df.plot(table=True, ax=ax) + df.plot(table=True, ax=ax); .. ipython:: python :suppress: @@ -1497,7 +1497,7 @@ as seen in the example below. ax.xaxis.tick_top() # Display x-axis ticks on top. @savefig line_plot_table_data.png - df.plot(table=np.round(df.T, 2), ax=ax) + df.plot(table=np.round(df.T, 2), ax=ax); .. ipython:: python :suppress: @@ -1515,10 +1515,10 @@ matplotlib `table