Skip to content

DOC: Fixing EX01 - Added examples #54217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
pandas.io.stata.StataReader.variable_labels \
pandas.io.stata.StataWriter.write_file \
pandas.plotting.deregister_matplotlib_converters \
pandas.plotting.plot_params \
pandas.plotting.register_matplotlib_converters \
pandas.plotting.table \
pandas.util.hash_array \
pandas.util.hash_pandas_object \
pandas_object \
Expand Down
29 changes: 29 additions & 0 deletions pandas/plotting/_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ def table(ax: Axes, data: DataFrame | Series, **kwargs) -> Table:
Returns
-------
matplotlib table object

Examples
--------

.. plot::
:context: close-figs

>>> import matplotlib.pyplot as plt
>>> df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
>>> fix, ax = plt.subplots()
>>> ax.axis('off')
(0.0, 1.0, 0.0, 1.0)
>>> table = pd.plotting.table(ax, df, loc='center',
... cellLoc='center', colWidths=list([.2, .2]))
"""
plot_backend = _get_plot_backend("matplotlib")
return plot_backend.table(
Expand Down Expand Up @@ -552,6 +566,21 @@ class _Options(dict):
Allows for parameter aliasing so you can just use parameter names that are
the same as the plot function parameters, but is stored in a canonical
format that makes it easy to breakdown into groups later.

Examples
--------

.. plot::
:context: close-figs

>>> np.random.seed(42)
>>> df = pd.DataFrame({'A': np.random.randn(10),
... 'B': np.random.randn(10)},
... index=pd.date_range("1/1/2000",
... freq='4MS', periods=10))
>>> with pd.plotting.plot_params.use("x_compat", True):
... _ = df["A"].plot(color="r")
... _ = df["B"].plot(color="g")
"""

# alias so the names are same as plotting method parameter names
Expand Down