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

Commitcb21ba7

Browse files
authored
Merge pull request#7410 from efiring/log_locator_vmin
BUG: fix autoscale_view with log scale and margins
2 parents263e675 +1ae616e commitcb21ba7

27 files changed

+16
-1
lines changed
Loading
Loading

‎lib/matplotlib/tests/test_axes.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4667,6 +4667,21 @@ def test_fillbetween_cycle():
46674667
asserttuple(cc.get_edgecolors().squeeze())==tuple(edge_target)
46684668

46694669

4670+
@cleanup
4671+
deftest_log_margins():
4672+
plt.rcParams['axes.autolimit_mode']='data'
4673+
fig,ax=plt.subplots()
4674+
margin=0.05
4675+
ax.set_xmargin(margin)
4676+
ax.semilogx([1,10], [1,10])
4677+
xlim0,xlim1=ax.get_xlim()
4678+
transform=ax.xaxis.get_transform()
4679+
xlim0t,xlim1t=transform.transform([xlim0,xlim1])
4680+
x0t,x1t=transform.transform([1,10])
4681+
delta= (x1t-x0t)*margin
4682+
assert_allclose([xlim0t+delta,xlim1t-delta], [x0t,x1t])
4683+
4684+
46704685
if__name__=='__main__':
46714686
importnose
46724687
importsys

‎lib/matplotlib/ticker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1912,7 +1912,7 @@ def view_limits(self, vmin, vmax):
19121912
"Data has no positive values, and therefore can not be "
19131913
"log-scaled.")
19141914

1915-
ifvmin<=minpos:
1915+
ifvmin<=0:
19161916
vmin=minpos
19171917

19181918
ifrcParams['axes.autolimit_mode']=='round_numbers':

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp