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

Commitbb19e7c

Browse files
committed
Merge v1.4.x into master
Conflicts:.travis.ymllib/matplotlib/tests/test_axes.pylib/matplotlib/tests/test_text.pylib/matplotlib/tests/test_transforms.pylib/matplotlib/transforms.py
2 parentsb90e2b3 +b8a5f91 commitbb19e7c

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

‎lib/matplotlib/axes/_base.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,16 @@ def _gen_axes_spines(self, locations=None, offset=0.0, units='inches'):
817817
defcla(self):
818818
"""Clear the current axes."""
819819
# Note: this is called by Axes.__init__()
820+
821+
# stash the current visibility state
822+
ifhasattr(self,'patch'):
823+
patch_visible=self.patch.get_visible()
824+
else:
825+
patch_visible=True
826+
827+
xaxis_visible=self.xaxis.get_visible()
828+
yaxis_visible=self.yaxis.get_visible()
829+
820830
self.xaxis.cla()
821831
self.yaxis.cla()
822832
forname,spineinsix.iteritems(self.spines):
@@ -942,6 +952,13 @@ def cla(self):
942952

943953
self._shared_x_axes.clean()
944954
self._shared_y_axes.clean()
955+
ifself._sharex:
956+
self.xaxis.set_visible(xaxis_visible)
957+
self.patch.set_visible(patch_visible)
958+
959+
ifself._sharey:
960+
self.yaxis.set_visible(yaxis_visible)
961+
self.patch.set_visible(patch_visible)
945962

946963
defclear(self):
947964
"""clear the axes"""

‎lib/matplotlib/tests/test_axes.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
importio
88

9-
fromnose.toolsimportassert_equal,assert_raises
9+
fromnose.toolsimportassert_equal,assert_raises,assert_false,assert_true
10+
1011
importdatetime
1112

1213
importnumpyasnp
@@ -102,6 +103,30 @@ def test_twin_axis_locaters_formatters():
102103
ax3=ax1.twinx()
103104

104105

106+
@cleanup
107+
deftest_twinx_cla():
108+
fig,ax=plt.subplots()
109+
ax2=ax.twinx()
110+
ax3=ax2.twiny()
111+
plt.draw()
112+
assert_false(ax2.xaxis.get_visible())
113+
assert_false(ax2.patch.get_visible())
114+
ax2.cla()
115+
ax3.cla()
116+
117+
assert_false(ax2.xaxis.get_visible())
118+
assert_false(ax2.patch.get_visible())
119+
assert_true(ax2.yaxis.get_visible())
120+
121+
assert_true(ax3.xaxis.get_visible())
122+
assert_false(ax3.patch.get_visible())
123+
assert_false(ax3.yaxis.get_visible())
124+
125+
assert_true(ax.xaxis.get_visible())
126+
assert_true(ax.patch.get_visible())
127+
assert_true(ax.yaxis.get_visible())
128+
129+
105130
@image_comparison(baseline_images=["autoscale_tiny_range"],remove_text=True)
106131
deftest_autoscale_tiny_range():
107132
# github pull #904

‎lib/matplotlib/transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ def transform(self, values):
13001300

13011301
# Convert the result back to the shape of the input values.
13021302
ifndim==0:
1303-
assertnotnp.ma.is_masked(res)# just to be on the safe side
1303+
assertnotnp.ma.is_masked(res)# just to be on the safe side
13041304
returnres[0,0]
13051305
ifndim==1:
13061306
returnres.reshape(-1)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp