Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaf8b460

Browse files
committed
Merge pull request#5685 from tacaswell/fix_toolkit_logcolorscale
FIX: do not use removed private methods
2 parentsf9e405e +de53d5c commitaf8b460

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

‎lib/mpl_toolkits/axes_grid1/colorbar.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,8 @@ def __init__(self, ax, cmap=None,
374374
ifformatisNone:
375375
ifisinstance(self.norm,colors.LogNorm):
376376
# change both axis for proper aspect
377-
self.ax.xaxis.set_scale("log")
378-
self.ax.yaxis.set_scale("log")
379-
self.ax._update_transScale()
377+
self.ax.set_xscale("log")
378+
self.ax.set_yscale("log")
380379
self.cbar_axis.set_minor_locator(ticker.NullLocator())
381380
formatter=ticker.LogFormatter()
382381
else:

‎lib/mpl_toolkits/tests/test_axes_grid1.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44
frommatplotlib.externalsimportsix
55

66
importmatplotlib.pyplotasplt
7-
frommatplotlib.testing.decoratorsimportimage_comparison
7+
frommatplotlib.testing.decoratorsimportimage_comparison,cleanup
8+
89
frommpl_toolkits.axes_grid1importmake_axes_locatable
10+
frommpl_toolkits.axes_grid1importAxesGrid
11+
12+
frommatplotlib.colorsimportLogNorm
13+
914
importnumpyasnp
1015

1116

@@ -50,6 +55,23 @@ def test_divider_append_axes():
5055
axHistleft.yaxis.set_ticklabels(())
5156
axHistright.yaxis.set_ticklabels(())
5257

58+
59+
@cleanup
60+
deftest_axesgrid_colorbar_log_smoketest():
61+
fig=plt.figure()
62+
grid=AxesGrid(fig,111,# modified to be only subplot
63+
nrows_ncols=(1,1),
64+
label_mode="L",
65+
cbar_location="top",
66+
cbar_mode="single",
67+
)
68+
69+
Z=10000*np.random.rand(10,10)
70+
im=grid[0].imshow(Z,interpolation="nearest",norm=LogNorm())
71+
72+
grid.cbar_axes[0].colorbar(im)
73+
74+
5375
if__name__=='__main__':
5476
importnose
5577
nose.runmodule(argv=['-s','--with-doctest'],exit=False)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp