Skip to content

Commit 7fffdb5

Browse files
committed
BUG: respect logy argument in KdePlot, close #1341
1 parent 4f33c14 commit 7fffdb5

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

pandas/tools/plotting.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def __init__(self, data, kind=None, by=None, subplots=False, sharex=True,
167167
figsize=None, grid=True, legend=True, rot=None,
168168
ax=None, fig=None, title=None, xlim=None, ylim=None,
169169
xticks=None, yticks=None,
170-
sort_columns=True, fontsize=None, **kwds):
170+
sort_columns=False, fontsize=None, **kwds):
171171

172172
self.data = data
173173
self.by = by
@@ -362,13 +362,22 @@ def _get_xticks(self):
362362

363363
return x
364364

365+
def _get_plot_function(self):
366+
if self.logy:
367+
plotf = self.plt.Axes.semilogy
368+
elif self.logx:
369+
plotf = self.plt.Axes.semilogx
370+
elif self.loglog:
371+
plotf = self.plt.Axes.loglog
372+
else:
373+
plotf = self.plt.Axes.plot
374+
375+
return plotf
376+
365377
class KdePlot(MPLPlot):
366378
def __init__(self, data, **kwargs):
367379
MPLPlot.__init__(self, data, **kwargs)
368380

369-
def _get_plot_function(self):
370-
return self.plt.Axes.plot
371-
372381
def _make_plot(self):
373382
from scipy.stats import gaussian_kde
374383
plotf = self._get_plot_function()
@@ -412,18 +421,6 @@ def has_ts_index(self):
412421
return has_freq or has_inferred
413422
return False
414423

415-
def _get_plot_function(self):
416-
if self.logy:
417-
plotf = self.plt.Axes.semilogy
418-
elif self.logx:
419-
plotf = self.plt.Axes.semilogx
420-
elif self.loglog:
421-
plotf = self.plt.Axes.loglog
422-
else:
423-
plotf = self.plt.Axes.plot
424-
425-
return plotf
426-
427424
def _make_plot(self):
428425
# this is slightly deceptive
429426
if self.use_index and self.has_ts_index:
@@ -492,7 +489,7 @@ def _make_ts_plot(self, data, **kwargs):
492489
tsplot(data[col], plotf, ax=ax, label=label, **kwargs)
493490
ax.grid(self.grid)
494491

495-
self.fig.subplots_adjust(wspace=0, hspace=0)
492+
# self.fig.subplots_adjust(wspace=0, hspace=0)
496493

497494

498495
def _post_plot_logic(self):
@@ -595,7 +592,7 @@ def _make_plot(self):
595592
ax.legend(patches, labels, loc='best',
596593
title=self.legend_title)
597594

598-
self.fig.subplots_adjust(top=0.8, wspace=0, hspace=0)
595+
# self.fig.subplots_adjust(top=0.8, wspace=0, hspace=0)
599596

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

0 commit comments

Comments
 (0)