-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Added ind and bw_method kwargs to KdePlot #4316
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
Conversation
looking good....pls add a mention in v0.13.0.txt and doc/source.release.rst (in the 0.13 section) |
great...looks mergable (as soon as we start the 0.13 ones)...@cpcloud? |
_check_plot_works(self.ts.plot, kind='kde', bw_method=.5, ind=linspace(-100,100,20)) | ||
_check_plot_works(self.ts.plot, kind='density', bw_method=.5, ind=linspace(-100,100,20)) | ||
ax = self.ts.plot(kind='kde', logy=True, bw_method=.5, ind=linspace(-100,100,20)) | ||
self.assert_(ax.get_yscale() == 'log') |
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.
can u make this self.assertEqual(ax.get_yscale(), 'log')
so that if it ever fails we can see what the value of the left hand side is? thanks.
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.
I can totally do that.
I modeled this test on the test_kde test:
@slow
def test_kde(self):
_skip_if_no_scipy()
_check_plot_works(self.ts.plot, kind='kde')
_check_plot_works(self.ts.plot, kind='density')
ax = self.ts.plot(kind='kde', logy=True)
self.assert_(ax.get_yscale() == 'log')
@slow
def test_kde_kwargs(self):
_skip_if_no_scipy()
from numpy import linspace
_check_plot_works(self.ts.plot, kind='kde', bw_method=.5, ind=linspace(-100,100,20))
_check_plot_works(self.ts.plot, kind='density', bw_method=.5, ind=linspace(-100,100,20))
ax = self.ts.plot(kind='kde', logy=True, bw_method=.5, ind=linspace(-100,100,20))
self.assert_(ax.get_yscale() == 'log')
Will change in both to be consistent, and to add the usefulness you describe to the already existing test as well.
@khgitting this looks good, can you rebase on master, then good to go? |
@jreback done. |
@khgitting can you squash to 1 commit? (like a rebase, but use 's' on the other commits) |
@jreback Rebased, squashing, on top of a fresh master from fetching upstream. |
Added ind and bw_method kwargs to KdePlot
@khgitting thanks! |
Adds ability to set the bandwidth used for the kde and the indices at which it is evaluated. The first is passed to the bw_method kwarg for scipy.stats.gaussian_kde (for scipy >= 0.11.0); the second is passed to gkde.evaluate. For the case when scipy < 0.11.0 but bw_method is specified, bw_method is ignored (not passed to scipy.stats.gaussian_kde), but a warning is issued to alert the user.
#4298