Skip to content

FIX: do not use removed private methods #5685

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 2 commits into from
Dec 16, 2015
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
5 changes: 2 additions & 3 deletions lib/mpl_toolkits/axes_grid1/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,8 @@ def __init__(self, ax, cmap=None,
if format is None:
if isinstance(self.norm, colors.LogNorm):
# change both axis for proper aspect
self.ax.xaxis.set_scale("log")
self.ax.yaxis.set_scale("log")
self.ax._update_transScale()
self.ax.set_xscale("log")
self.ax.set_yscale("log")
self.cbar_axis.set_minor_locator(ticker.NullLocator())
formatter = ticker.LogFormatter()
else:
Expand Down
24 changes: 23 additions & 1 deletion lib/mpl_toolkits/tests/test_axes_grid1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
from matplotlib.externals import six

import matplotlib.pyplot as plt
from matplotlib.testing.decorators import image_comparison
from matplotlib.testing.decorators import image_comparison, cleanup

from mpl_toolkits.axes_grid1 import make_axes_locatable
from mpl_toolkits.axes_grid1 import AxesGrid

from matplotlib.colors import LogNorm

import numpy as np


Expand Down Expand Up @@ -50,6 +55,23 @@ def test_divider_append_axes():
axHistleft.yaxis.set_ticklabels(())
axHistright.yaxis.set_ticklabels(())


@cleanup
def test_axesgrid_colorbar_log_smoketest():
fig = plt.figure()
grid = AxesGrid(fig, 111, # modified to be only subplot
nrows_ncols=(1, 1),
label_mode="L",
cbar_location="top",
cbar_mode="single",
)

Z = 10000 * np.random.rand(10, 10)
im = grid[0].imshow(Z, interpolation="nearest", norm=LogNorm())

grid.cbar_axes[0].colorbar(im)


if __name__ == '__main__':
import nose
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)