Skip to content

PLOT: Split matplotlib specific code from pandas plotting #26414

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 34 commits into from
Jun 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2b69bf9
First split of matplotlib functions from pandas plotting core
May 15, 2019
13052a4
Splitting matplotlib backend code from pandas plotting
May 16, 2019
703cd93
isort
May 16, 2019
965abc9
Removing boxplot import from __init__.py
May 16, 2019
0e45c2a
Import plot backend in a lazy way
May 16, 2019
d9de39c
Merge remote-tracking branch 'upstream/master' into plot
datapythonista May 16, 2019
1c5a979
Renaming files as per review, and isort
datapythonista May 16, 2019
4f235ca
Merge remote-tracking branch 'upstream/master' into plot
May 17, 2019
5617b37
Splitting the rest of public plotting functions (the accessors were a…
May 17, 2019
6915970
Fixing imports and linting
datapythonista May 18, 2019
3e094bc
Fixing imports and restoring boxplot as a public method
datapythonista May 18, 2019
d0edd22
Fixing bug on warning stacklevel of moved function
datapythonista May 18, 2019
5b03c9b
Avoiding imports inside pandas.plotting (pandas should only import pu…
datapythonista May 18, 2019
b454880
Merge remote-tracking branch 'upstream/master' into plot
datapythonista May 18, 2019
0212206
Working on fixing the duplicate plots problem
datapythonista May 18, 2019
5b2eb8b
Avoid importing _matplotlib/ from plotting/_core.py
datapythonista May 19, 2019
b0ee88f
Bugfixing (only 2 tests failing)
datapythonista May 21, 2019
a078c6e
Fixing last failing plotting tests
datapythonista May 24, 2019
44d35a6
Merging from master
datapythonista May 24, 2019
0ad0f94
Only importing matplotlib in tests when it's installed
datapythonista May 24, 2019
52ee285
Not importing matplotlib in hist tests if it's not installed
datapythonista May 24, 2019
9fd979a
Merge remote-tracking branch 'upstream/master' into plot
datapythonista May 26, 2019
106df36
Addressing PR comments (adding docstring, moving _get_plot_backend, a…
datapythonista May 26, 2019
9fbd8e2
Merge remote-tracking branch 'upstream/master' into plot
datapythonista May 29, 2019
418dd2f
Merging from master
May 31, 2019
53bbe71
Merge branch 'plot' of https://github.com/datapythonista/pandas into …
May 31, 2019
ef6a79d
Resolving error after merging master (invalid import)
datapythonista May 31, 2019
20d4db4
Merging from master
Jun 6, 2019
5b9e34e
Merge remote-tracking branch 'upstream/master' into plot
datapythonista Jun 7, 2019
4e63fa9
Avoiding recursive import
datapythonista Jun 7, 2019
207788f
Add missing register/deregister to the public pandas-matplotlib API
datapythonista Jun 7, 2019
09b916a
registering converters
datapythonista Jun 7, 2019
ceedd3b
isort
datapythonista Jun 7, 2019
0dba165
Merging from master
datapythonista Jun 8, 2019
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: 1 addition & 1 deletion asv_bench/benchmarks/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pandas import to_datetime, date_range, Series, DataFrame, period_range
from pandas.tseries.frequencies import infer_freq
try:
from pandas.plotting._converter import DatetimeConverter
from pandas.plotting._matplotlib.converter import DatetimeConverter
except ImportError:
from pandas.tseries.converter import DatetimeConverter

Expand Down
8 changes: 4 additions & 4 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
from pandas.io.formats import format as fmt
from pandas.io.formats.printing import pprint_thing

import pandas.plotting._core as gfx
import pandas.plotting

# ---------------------------------------------------------------------
# Docstring templates
Expand Down Expand Up @@ -8041,9 +8041,9 @@ def isin(self, values):

# ----------------------------------------------------------------------
# Add plotting methods to DataFrame
plot = CachedAccessor("plot", gfx.FramePlotMethods)
hist = gfx.hist_frame
boxplot = gfx.boxplot_frame
plot = CachedAccessor("plot", pandas.plotting.FramePlotMethods)
hist = pandas.plotting.hist_frame
boxplot = pandas.plotting.boxplot_frame
sparse = CachedAccessor("sparse", SparseFrameAccessor)


Expand Down
2 changes: 1 addition & 1 deletion pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from pandas.core.series import Series
from pandas.core.sparse.frame import SparseDataFrame

from pandas.plotting._core import boxplot_frame_groupby
from pandas.plotting import boxplot_frame_groupby

NamedAgg = namedtuple("NamedAgg", ["column", "aggfunc"])
# TODO(typing) the return value on this callable should be any *scalar*.
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from pandas.core.tools.datetimes import to_datetime

import pandas.io.formats.format as fmt
import pandas.plotting._core as gfx
import pandas.plotting

__all__ = ['Series']

Expand Down Expand Up @@ -4502,12 +4502,12 @@ def to_period(self, freq=None, copy=True):
str = CachedAccessor("str", StringMethods)
dt = CachedAccessor("dt", CombinedDatetimelikeProperties)
cat = CachedAccessor("cat", CategoricalAccessor)
plot = CachedAccessor("plot", gfx.SeriesPlotMethods)
plot = CachedAccessor("plot", pandas.plotting.SeriesPlotMethods)
sparse = CachedAccessor("sparse", SparseAccessor)

# ----------------------------------------------------------------------
# Add plotting methods to Series
hist = gfx.hist_series
hist = pandas.plotting.hist_series


Series._setup_axes(['index'], info_axis=0, stat_axis=0, aliases={'rows': 0},
Expand Down
32 changes: 15 additions & 17 deletions pandas/plotting/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
"""
Plotting api
Plotting public API
"""
from pandas.plotting._core import (
FramePlotMethods, SeriesPlotMethods, boxplot, boxplot_frame,
boxplot_frame_groupby, hist_frame, hist_series)
from pandas.plotting._misc import (
andrews_curves, autocorrelation_plot, bootstrap_plot,
deregister as deregister_matplotlib_converters, lag_plot,
parallel_coordinates, plot_params, radviz,
register as register_matplotlib_converters, scatter_matrix, table)

# flake8: noqa

from pandas.plotting._misc import (scatter_matrix, radviz,
andrews_curves, bootstrap_plot,
parallel_coordinates, lag_plot,
autocorrelation_plot)
from pandas.plotting._core import boxplot
from pandas.plotting._style import plot_params
from pandas.plotting._tools import table
try:
from pandas.plotting._converter import (
register as register_matplotlib_converters)
from pandas.plotting._converter import (
deregister as deregister_matplotlib_converters)
except ImportError:
pass
__all__ = ['boxplot', 'boxplot_frame', 'boxplot_frame_groupby', 'hist_frame',
'hist_series', 'FramePlotMethods', 'SeriesPlotMethods',
'scatter_matrix', 'radviz', 'andrews_curves', 'bootstrap_plot',
'parallel_coordinates', 'lag_plot', 'autocorrelation_plot',
'table', 'plot_params', 'register_matplotlib_converters',
'deregister_matplotlib_converters']
Loading