Skip to content

BUG: MPLPlot cannot make loglog keyword worked #6722

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 1 commit into from
Mar 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions pandas/tests/test_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,22 @@ def test_plot_xy(self):
# columns.inferred_type == 'mixed'
# TODO add MultiIndex test

@slow
def test_logscales(self):
df = DataFrame({'a': np.arange(100)},
index=np.arange(100))
ax = df.plot(logy=True)
self.assertEqual(ax.xaxis.get_scale(), 'linear')
self.assertEqual(ax.yaxis.get_scale(), 'log')

ax = df.plot(logx=True)
self.assertEqual(ax.xaxis.get_scale(), 'log')
self.assertEqual(ax.yaxis.get_scale(), 'linear')

ax = df.plot(loglog=True)
self.assertEqual(ax.xaxis.get_scale(), 'log')
self.assertEqual(ax.yaxis.get_scale(), 'log')

@slow
def test_xcompat(self):
import pandas as pd
Expand Down Expand Up @@ -1229,6 +1245,7 @@ def test_errorbar_plot(self):
# check line plots
_check_plot_works(df.plot, yerr=df_err, logy=True)
_check_plot_works(df.plot, yerr=df_err, logx=True, logy=True)
_check_plot_works(df.plot, yerr=df_err, loglog=True)

kinds = ['line', 'bar', 'barh']
for kind in kinds:
Expand Down
16 changes: 10 additions & 6 deletions pandas/tools/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,9 +976,9 @@ def _setup_subplots(self):

axes = [ax]

if self.logx:
if self.logx or self.loglog:
[a.set_xscale('log') for a in axes]
if self.logy:
if self.logy or self.loglog:
[a.set_yscale('log') for a in axes]

self.fig = fig
Expand Down Expand Up @@ -1879,9 +1879,11 @@ def plot_frame(frame=None, x=None, y=None, subplots=False, sharex=True,
scatter: scatter plot
hexbin: hexbin plot
logx : boolean, default False
For line plots, use log scaling on x axis
Use log scaling on x axis
logy : boolean, default False
For line plots, use log scaling on y axis
Use log scaling on y axis
loglog : boolean, default False
Use log scaling on both x and y axes
xticks : sequence
Values to use for the xticks
yticks : sequence
Expand Down Expand Up @@ -2031,9 +2033,11 @@ def plot_series(series, label=None, kind='line', use_index=True, rot=None,
grid : matplotlib grid
legend: matplotlib legend
logx : boolean, default False
For line plots, use log scaling on x axis
Use log scaling on x axis
logy : boolean, default False
For line plots, use log scaling on y axis
Use log scaling on y axis
loglog : boolean, default False
Use log scaling on both x and y axes
secondary_y : boolean or sequence of ints, default False
If True then y-axis will be on the right
figsize : a tuple (width, height) in inches
Expand Down