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

Appearance settings

Commit fd9c0b6

Browse filesBrowse files
committed
Merge remote-tracking branch 'upstream/v1.2.x'
Conflicts: CHANGELOG lib/matplotlib/axes.py
2 parents b93936f + 6a12658 commit fd9c0b6
Copy full SHA for fd9c0b6

File tree

Expand file treeCollapse file tree

6 files changed

+45
-20
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+45
-20
lines changed

‎lib/matplotlib/axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes.py
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2429,7 +2429,7 @@ def set_axis_bgcolor(self, color):
24292429
def invert_xaxis(self):
24302430
"Invert the x-axis."
24312431
left, right = self.get_xlim()
2432-
self.set_xlim(right, left)
2432+
self.set_xlim(right, left, auto=None)
24332433

24342434
def xaxis_inverted(self):
24352435
"""Returns *True* if the x-axis is inverted."""
@@ -2655,7 +2655,7 @@ def invert_yaxis(self):
26552655
Invert the y-axis.
26562656
"""
26572657
bottom, top = self.get_ylim()
2658-
self.set_ylim(top, bottom)
2658+
self.set_ylim(top, bottom, auto=None)
26592659

26602660
def yaxis_inverted(self):
26612661
"""Returns *True* if the y-axis is inverted."""
@@ -6075,6 +6075,12 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
60756075
warnings.warn(
60766076
'''replace "faceted=False" with "edgecolors='none'"''',
60776077
mplDeprecation) # 2008/04/18
6078+
<<<<<<< HEAD
6079+
=======
6080+
6081+
sym = None
6082+
symstyle = 0
6083+
>>>>>>> upstream/v1.2.x
60786084

60796085
# to be API compatible
60806086
if marker is None and not (verts is None):
@@ -8632,7 +8638,7 @@ def specgram(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
86328638
spectrum is shown. If *x* is complex, both positive and
86338639
negative parts of the spectrum are shown. This can be
86348640
overridden using the *sides* keyword argument.
8635-
8641+
86368642
Also note that while the plot is in dB, the *Pxx* array returned is
86378643
linear in power.
86388644

‎lib/matplotlib/font_manager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/font_manager.py
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,10 @@ def createFontList(fontfiles, fontext='ttf'):
565565
except RuntimeError:
566566
verbose.report("Could not parse font file %s"%fpath)
567567
continue
568-
prop = afmFontProperty(fpath, font)
568+
try:
569+
prop = afmFontProperty(fpath, font)
570+
except KeyError:
571+
continue
569572
else:
570573
try:
571574
font = ft2font.FT2Font(str(fpath))
@@ -576,7 +579,10 @@ def createFontList(fontfiles, fontext='ttf'):
576579
verbose.report("Cannot handle unicode filenames")
577580
#print >> sys.stderr, 'Bad file is', fpath
578581
continue
579-
prop = ttfFontProperty(font)
582+
try:
583+
prop = ttfFontProperty(font)
584+
except KeyError:
585+
continue
580586

581587
fontlist.append(prop)
582588
return fontlist

‎lib/matplotlib/projections/polar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/projections/polar.py
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,10 @@ def transform_non_affine(self, tr):
5757
t *= theta_direction
5858
t += theta_offset
5959

60-
if rmin != 0:
61-
r = r - rmin
62-
mask = r < 0
63-
x[:] = np.where(mask, np.nan, r * np.cos(t))
64-
y[:] = np.where(mask, np.nan, r * np.sin(t))
65-
else:
66-
x[:] = r * np.cos(t)
67-
y[:] = r * np.sin(t)
60+
r = r - rmin
61+
mask = r < 0
62+
x[:] = np.where(mask, np.nan, r * np.cos(t))
63+
y[:] = np.where(mask, np.nan, r * np.sin(t))
6864

6965
return xy
7066
transform_non_affine.__doc__ = Transform.transform_non_affine.__doc__
@@ -779,4 +775,3 @@ def drag_pan(self, button, key, x, y):
779775
# result = self.transform(result)
780776
# return mpath.Path(result, codes)
781777
# transform_path_non_affine = transform_path
782-

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,29 @@ def test_hexbin_extent():
419419

420420
ax.hexbin(x, y, extent=[.1, .3, .6, .7])
421421

422+
@cleanup
423+
def test_inverted_limits():
424+
# Test gh:1553
425+
# Calling invert_xaxis prior to plotting should not disable autoscaling
426+
# while still maintaining the inverted direction
427+
fig = plt.figure()
428+
ax = fig.gca()
429+
ax.invert_xaxis()
430+
ax.plot([-5, -3, 2, 4], [1, 2, -3, 5])
431+
432+
assert ax.get_xlim() == (4, -5)
433+
assert ax.get_ylim() == (-3, 5)
434+
plt.close()
435+
436+
fig = plt.figure()
437+
ax = fig.gca()
438+
ax.invert_yaxis()
439+
ax.plot([-5, -3, 2, 4], [1, 2, -3, 5])
440+
441+
assert ax.get_xlim() == (-5, 4)
442+
assert ax.get_ylim() == (5, -3)
443+
plt.close()
444+
422445
@image_comparison(baseline_images=['nonfinite_limits'])
423446
def test_nonfinite_limits():
424447
x = np.arange(0., np.e, 0.01)

‎lib/mpl_toolkits/mplot3d/axes3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/axes3d.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ def invert_zaxis(self):
13891389
This function was added, but not tested. Please report any bugs.
13901390
"""
13911391
bottom, top = self.get_zlim()
1392-
self.set_zlim(top, bottom)
1392+
self.set_zlim(top, bottom, auto=None)
13931393

13941394
def zaxis_inverted(self):
13951395
'''

‎src/ft2font.cpp

Copy file name to clipboardExpand all lines: src/ft2font.cpp
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -852,28 +852,24 @@ FT2Font::FT2Font(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds)
852852
{
853853
std::ostringstream s;
854854
s << "Could not load facefile " << facefile << "; Unknown_File_Format" << std::endl;
855-
ob_refcnt--;
856855
throw Py::RuntimeError(s.str());
857856
}
858857
else if (error == FT_Err_Cannot_Open_Resource)
859858
{
860859
std::ostringstream s;
861860
s << "Could not open facefile " << facefile << "; Cannot_Open_Resource" << std::endl;
862-
ob_refcnt--;
863861
throw Py::RuntimeError(s.str());
864862
}
865863
else if (error == FT_Err_Invalid_File_Format)
866864
{
867865
std::ostringstream s;
868866
s << "Could not open facefile " << facefile << "; Invalid_File_Format" << std::endl;
869-
ob_refcnt--;
870867
throw Py::RuntimeError(s.str());
871868
}
872869
else if (error)
873870
{
874871
std::ostringstream s;
875872
s << "Could not open facefile " << facefile << "; freetype error code " << error << std::endl;
876-
ob_refcnt--;
877873
throw Py::RuntimeError(s.str());
878874
}
879875

@@ -891,7 +887,6 @@ FT2Font::FT2Font(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds)
891887
{
892888
std::ostringstream s;
893889
s << "Could not set the fontsize for facefile " << facefile << std::endl;
894-
ob_refcnt--;
895890
throw Py::RuntimeError(s.str());
896891
}
897892

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.