Skip to content

Commit

Permalink
BUG: respect logy argument in KdePlot, close #1341
Browse files Browse the repository at this point in the history
  • Loading branch information
wesm committed May 29, 2012
1 parent 4f33c14 commit 7fffdb5
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions pandas/tools/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def __init__(self, data, kind=None, by=None, subplots=False, sharex=True,
figsize=None, grid=True, legend=True, rot=None,
ax=None, fig=None, title=None, xlim=None, ylim=None,
xticks=None, yticks=None,
sort_columns=True, fontsize=None, **kwds):
sort_columns=False, fontsize=None, **kwds):

self.data = data
self.by = by
Expand Down Expand Up @@ -362,13 +362,22 @@ def _get_xticks(self):

return x

def _get_plot_function(self):
if self.logy:
plotf = self.plt.Axes.semilogy
elif self.logx:
plotf = self.plt.Axes.semilogx
elif self.loglog:
plotf = self.plt.Axes.loglog
else:
plotf = self.plt.Axes.plot

return plotf

class KdePlot(MPLPlot):
def __init__(self, data, **kwargs):
MPLPlot.__init__(self, data, **kwargs)

def _get_plot_function(self):
return self.plt.Axes.plot

def _make_plot(self):
from scipy.stats import gaussian_kde
plotf = self._get_plot_function()
Expand Down Expand Up @@ -412,18 +421,6 @@ def has_ts_index(self):
return has_freq or has_inferred
return False

def _get_plot_function(self):
if self.logy:
plotf = self.plt.Axes.semilogy
elif self.logx:
plotf = self.plt.Axes.semilogx
elif self.loglog:
plotf = self.plt.Axes.loglog
else:
plotf = self.plt.Axes.plot

return plotf

def _make_plot(self):
# this is slightly deceptive
if self.use_index and self.has_ts_index:
Expand Down Expand Up @@ -492,7 +489,7 @@ def _make_ts_plot(self, data, **kwargs):
tsplot(data[col], plotf, ax=ax, label=label, **kwargs)
ax.grid(self.grid)

self.fig.subplots_adjust(wspace=0, hspace=0)
# self.fig.subplots_adjust(wspace=0, hspace=0)


def _post_plot_logic(self):
Expand Down Expand Up @@ -595,7 +592,7 @@ def _make_plot(self):
ax.legend(patches, labels, loc='best',
title=self.legend_title)

self.fig.subplots_adjust(top=0.8, wspace=0, hspace=0)
# self.fig.subplots_adjust(top=0.8, wspace=0, hspace=0)

def _post_plot_logic(self):
for ax in self.axes:
Expand Down Expand Up @@ -629,7 +626,7 @@ def plot_frame(frame=None, subplots=False, sharex=True, sharey=False,
xlim=None, ylim=None, logy=False,
xticks=None, yticks=None,
kind='line',
sort_columns=True, fontsize=None, **kwds):
sort_columns=False, fontsize=None, **kwds):
"""
Make line or bar plot of DataFrame's series with the index on the x-axis
using matplotlib / pylab.
Expand All @@ -646,7 +643,7 @@ def plot_frame(frame=None, subplots=False, sharex=True, sharey=False,
Use index as ticks for x axis
stacked : boolean, default False
If True, create stacked bar plot. Only valid for DataFrame input
sort_columns: boolean, default True
sort_columns: boolean, default False
Sort column names to determine plot ordering
title : string
Title to use for the plot
Expand Down

0 comments on commit 7fffdb5

Please sign in to comment.