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

Commit9bc8097

Browse files
committed
Fix axis inversion with loglocator and logitlocator.
1 parentd8123e6 commit9bc8097

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

‎doc/api/next_api_changes/2019-03-04-AL.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,3 @@ properties of the `.Collection` object:
4747
While this seems complicated, the logic is simply to use the information from
4848
the object that are in data space for the limits, but not information that is
4949
in physical units.
50-
51-
LogLocator.nonsingular now maintains the orders of its arguments
52-
````````````````````````````````````````````````````````````````
53-
54-
It no longer reorders them in increasing order. The new behavior is consistent
55-
with MaxNLocator.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
API changes
2+
```````````
3+
4+
``Locator.nonsingular`` (introduced in mpl 3.1), ``DateLocator.nonsingular``, and
5+
``AutoDateLocator.nonsingular`` now returns a range ``v0, v1`` with ``v0 <= v1``.
6+
This behavior is consistent with the implementation of ``nonsingular`` by the
7+
``LogLocator`` and ``LogitLocator`` subclasses.

‎lib/matplotlib/dates.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,8 +1117,9 @@ def nonsingular(self, vmin, vmax):
11171117
"""
11181118
Given the proposed upper and lower extent, adjust the range
11191119
if it is too close to being singular (i.e. a range of ~0).
1120-
11211120
"""
1121+
ifvmax<vmin:
1122+
vmin,vmax=vmax,vmin
11221123
unit=self._get_unit()
11231124
interval=self._get_interval()
11241125
ifabs(vmax-vmin)<1e-6:
@@ -1336,6 +1337,8 @@ def tick_values(self, vmin, vmax):
13361337
defnonsingular(self,vmin,vmax):
13371338
# whatever is thrown at us, we can scale the unit.
13381339
# But default nonsingular date plots at an ~4 year period.
1340+
ifvmax<vmin:
1341+
vmin,vmax=vmax,vmin
13391342
ifvmin==vmax:
13401343
vmin=vmin-DAYS_PER_YEAR*2
13411344
vmax=vmax+DAYS_PER_YEAR*2

‎lib/matplotlib/ticker.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,9 +2495,7 @@ def view_limits(self, vmin, vmax):
24952495
returnvmin,vmax
24962496

24972497
defnonsingular(self,vmin,vmax):
2498-
swap_vlims=False
24992498
ifvmin>vmax:
2500-
swap_vlims=True
25012499
vmin,vmax=vmax,vmin
25022500
ifnotnp.isfinite(vmin)ornotnp.isfinite(vmax):
25032501
vmin,vmax=1,10# Initial range, no data plotted yet.
@@ -2515,8 +2513,6 @@ def nonsingular(self, vmin, vmax):
25152513
ifvmin==vmax:
25162514
vmin=_decade_less(vmin,self._base)
25172515
vmax=_decade_greater(vmax,self._base)
2518-
ifswap_vlims:
2519-
vmin,vmax=vmax,vmin
25202516
returnvmin,vmax
25212517

25222518

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp