-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
CLN: move plotting funcs to pd.plotting #13579
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
Changes from 1 commit
fb94cc6
c545273
2c4bbb6
1c1efe1
fe8b918
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from pandas.plotting.api import * # noqa |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
""" | ||
Plotting api | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this is a bit the style in other pandas modules as well, but can't we just put this in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is cleaner here actually. And it is only imported explicity (unlike There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean with implicitly imported? The difference with the other modules where we use this pattern, is that, eg in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what I mean is, unless you explicity reference these imports, like thoughI guess for back-compat this is needed. IOW, the imports for things like |
||
""" | ||
|
||
# flake8: noqa | ||
|
||
try: # mpl optional | ||
from pandas.plotting import converter as conv | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would leave out the |
||
conv.register() # needs to override so set_xlim works with str/number | ||
except ImportError: | ||
pass | ||
|
||
from pandas.plotting.misc import (scatter_matrix, radviz, | ||
andrews_curves, bootstrap_plot, | ||
parallel_coordinates, lag_plot, | ||
autocorrelation_plot) | ||
from pandas.plotting.plotting import (boxplot, scatter_plot, grouped_hist, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not the most important :-), but the I am also not sure if |
||
hist_frame, hist_series) | ||
from pandas.plotting.style import plot_params | ||
from pandas.plotting.tools import table |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# being a bit too dynamic | ||
# pylint: disable=E1101 | ||
from __future__ import division | ||
|
||
from distutils.version import LooseVersion | ||
|
||
|
||
def _mpl_le_1_2_1(): | ||
try: | ||
import matplotlib as mpl | ||
return (str(mpl.__version__) <= LooseVersion('1.2.1') and | ||
str(mpl.__version__)[0] != '0') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to add these checks for |
||
except ImportError: | ||
return False | ||
|
||
|
||
def _mpl_ge_1_3_1(): | ||
try: | ||
import matplotlib | ||
# The or v[0] == '0' is because their versioneer is | ||
# messed up on dev | ||
return (matplotlib.__version__ >= LooseVersion('1.3.1') or | ||
matplotlib.__version__[0] == '0') | ||
except ImportError: | ||
return False | ||
|
||
|
||
def _mpl_ge_1_4_0(): | ||
try: | import matplotlib | |
return (matplotlib.__version__ >= LooseVersion('1.4') or | ||
matplotlib.__version__[0] == '0') | ||
except ImportError: | ||
return False | ||
|
||
|
||
def _mpl_ge_1_5_0(): | ||
try: | ||
import matplotlib | ||
return (matplotlib.__version__ >= LooseVersion('1.5') or | ||
matplotlib.__version__[0] == '0') | ||
except ImportError: | ||
return False | ||
|
||
|
||
def _mpl_ge_2_0_0(): | ||
try: | ||
import matplotlib | ||
return matplotlib.__version__ >= LooseVersion('2.0') | ||
except ImportError: | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from pandas.tools.plotting import scatter_matrix
from matplotlib import cm
feature_names = ['mass', 'width', 'height', 'color_score']
X = fruits[feature_names]
y = fruits['fruit_label']
cmap = cm.get_cmap('gnuplot')
scatter = pd.scatter_matrix(X, c = y, marker = 'o', s=40, hist_kwds={'bins':15}, figsize=(9,9), cmap = cmap)
plt.suptitle('Scatter-matrix for each input variable')
plt.savefig('fruits_scatter_matrix')