Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7574ae7

Browse files
committed
Merge remote-tracking branch 'upstream/v1.2.x'
Conflicts: lib/matplotlib/axes.py
2 parents 84dffb2 + accd49c commit 7574ae7

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

lib/matplotlib/axes.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,8 +2016,11 @@ def draw(self, renderer=None, inframe=False):
20162016
if self.axison and self._frameon:
20172017
artists.extend(self.spines.itervalues())
20182018

2019-
dsu = [(a.zorder, a) for a in artists
2020-
if not a.get_animated()]
2019+
if self.figure.canvas.is_saving():
2020+
dsu = [(a.zorder, a) for a in artists]
2021+
else:
2022+
dsu = [(a.zorder, a) for a in artists
2023+
if not a.get_animated()]
20212024

20222025
# add images to dsu if the backend support compositing.
20232026
# otherwise, does the manaul compositing without adding images to dsu.
@@ -6031,15 +6034,15 @@ def computeConfInterval(data, med, iq, bootstrap):
60316034
wisk_hi = q3
60326035
else:
60336036
wisk_hi = max(wisk_hi)
6034-
6037+
60356038
# get low extreme
60366039
lo_val = q1 - whis * iq
60376040
wisk_lo = np.compress(d >= lo_val, d)
60386041
if len(wisk_lo) == 0 or np.min(wisk_lo) > q1:
60396042
wisk_lo = q1
60406043
else:
60416044
wisk_lo = min(wisk_lo)
6042-
6045+
60436046
# get fliers - if we are showing them
60446047
flier_hi = []
60456048
flier_lo = []

lib/matplotlib/backend_bases.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,13 +1571,21 @@ def __init__(self, figure):
15711571
self.scroll_pick_id = self.mpl_connect('scroll_event', self.pick)
15721572
self.mouse_grabber = None # the axes currently grabbing mouse
15731573
self.toolbar = None # NavigationToolbar2 will set me
1574+
self._is_saving = False
15741575
if False:
15751576
## highlight the artists that are hit
15761577
self.mpl_connect('motion_notify_event', self.onHilite)
15771578
## delete the artists that are clicked on
15781579
#self.mpl_disconnect(self.button_pick_id)
15791580
#self.mpl_connect('button_press_event',self.onRemove)
15801581

1582+
def is_saving(self):
1583+
"""
1584+
Returns `True` when the renderer is in the process of saving
1585+
to a file, rather than rendering for an on-screen buffer.
1586+
"""
1587+
return self._is_saving
1588+
15811589
def onRemove(self, ev):
15821590
"""
15831591
Mouse event processor which removes the top artist
@@ -2205,6 +2213,7 @@ def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
22052213
else:
22062214
_bbox_inches_restore = None
22072215

2216+
self._is_saving = True
22082217
try:
22092218
#result = getattr(self, method_name)(
22102219
result = print_method(
@@ -2223,6 +2232,7 @@ def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
22232232
self.figure.set_facecolor(origfacecolor)
22242233
self.figure.set_edgecolor(origedgecolor)
22252234
self.figure.set_canvas(self)
2235+
self._is_saving = False
22262236
#self.figure.canvas.draw() ## seems superfluous
22272237
return result
22282238

@@ -2269,6 +2279,7 @@ def switch_backends(self, FigureCanvasClass):
22692279
figure size or line props), will be reflected in the other
22702280
"""
22712281
newCanvas = FigureCanvasClass(self.figure)
2282+
newCanvas._is_saving = self._is_saving
22722283
return newCanvas
22732284

22742285
def mpl_connect(self, s, func):

lib/matplotlib/backends/backend_ps.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -824,14 +824,13 @@ def draw_gouraud_triangles(self, gc, points, colors, trans):
824824
assert colors.shape[1] == 3
825825
assert colors.shape[2] == 4
826826

827-
points = trans.transform(points)
828-
829827
shape = points.shape
830828
flat_points = points.reshape((shape[0] * shape[1], 2))
829+
flat_points = trans.transform(flat_points)
831830
flat_colors = colors.reshape((shape[0] * shape[1], 4))
832-
points_min = np.min(flat_points, axis=0) - (1 << 8)
833-
points_max = np.max(flat_points, axis=0) + (1 << 8)
834-
factor = float(0xffffffff) / (points_max - points_min)
831+
points_min = np.min(flat_points, axis=0) - (1 << 12)
832+
points_max = np.max(flat_points, axis=0) + (1 << 12)
833+
factor = np.ceil(float(2 ** 32 - 1) / (points_max - points_min))
835834

836835
xmin, ymin = points_min
837836
xmax, ymax = points_max

0 commit comments

Comments
 (0)