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

Skip to content

Commit bbf9bdd

Browse files
committed
We really can not let these merges pile up over time...
Merge branch 'v1.1.x' Conflicts: lib/matplotlib/backends/backend_pdf.py lib/matplotlib/backends/backend_ps.py lib/matplotlib/backends/backend_svg.py lib/matplotlib/markers.py
2 parents 391f509 + cfd50c8 commit bbf9bdd

7 files changed

Lines changed: 29 additions & 19 deletions

File tree

lib/matplotlib/backends/backend_ps.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None)
613613

614614
if stroke:
615615
ps_cmd.append('stroke')
616+
ps_cmd.extend(['grestore', '} bind def'])
616617

617618
for vertices, code in path.iter_segments(trans, simplify=False):
618619
if len(vertices):

lib/matplotlib/backends/backend_qt4.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,17 @@ def __init__( self, figure ):
159159
w,h = self.get_width_height()
160160
self.resize( w, h )
161161

162+
# JDH: Note the commented out code below does not work as
163+
# expected, because according to Pierre Raybaut, The reason is
164+
# that PyQt fails (silently) to call a method of this object
165+
# just before detroying it. Using a lambda function will work,
166+
# exactly the same as using a function (which is not bound to
167+
# the object to be destroyed).
168+
#
169+
#QtCore.QObject.connect(self, QtCore.SIGNAL('destroyed()'),
170+
# self.close_event)
162171
QtCore.QObject.connect(self, QtCore.SIGNAL('destroyed()'),
163-
self.close_event)
172+
lambda: self.close_event())
164173

165174
def __timerEvent(self, event):
166175
# hide until we can test and fix

lib/matplotlib/colors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
'lightcyan' : '#E0FFFF',
129129
'lightgoldenrodyellow' : '#FAFAD2',
130130
'lightgreen' : '#90EE90',
131-
'lightgrey' : '#D3D3D3',
131+
'lightgray' : '#D3D3D3',
132132
'lightpink' : '#FFB6C1',
133133
'lightsalmon' : '#FFA07A',
134134
'lightseagreen' : '#20B2AA',

lib/matplotlib/markers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,13 @@ def _set_pixel(self):
283283
# Ideally, you'd want -0.5, -0.5 here, but then the snapping
284284
# algorithm in the Agg backend will round this to a 2x2
285285
# rectangle from (-1, -1) to (1, 1). By offsetting it
286-
# slightly, we can force it to be (0, -1) to (1, 0), which
287-
# both makes it only be a single pixel and places it correctly
288-
# with 1-width stroking (i.e. the ticks). This hack is the
289-
# best of a number of bad alternatives, mainly because the
286+
# slightly, we can force it to be (0, 0) to (1, 1), which both
287+
# makes it only be a single pixel and places it correctly
288+
# aligned to 1-width stroking (i.e. the ticks). This hack is
289+
# the best of a number of bad alternatives, mainly because the
290290
# backends are not aware of what marker is actually being used
291291
# beyond just its path data.
292-
self._transform = Affine2D().translate(-0.49999, -0.50001)
292+
self._transform = Affine2D().translate(-0.49999, -0.49999)
293293
self._snap_threshold = None
294294

295295
def _set_point(self):

lib/matplotlib/path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ def arc(cls, theta1, theta2, n=None, is_wedge=False):
631631

632632
if is_wedge:
633633
length = n * 3 + 4
634-
vertices = np.empty((length, 2), np.float_)
634+
vertices = np.zeros((length, 2), np.float_)
635635
codes = cls.CURVE4 * np.ones((length, ), cls.code_type)
636636
vertices[1] = [xA[0], yA[0]]
637637
codes[0:2] = [cls.MOVETO, cls.LINETO]

src/_backend_agg.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -443,10 +443,10 @@ RendererAgg::set_clipbox(const Py::Object& cliprect, R& rasterizer)
443443
double l, b, r, t;
444444
if (py_convert_bbox(cliprect.ptr(), l, b, r, t))
445445
{
446-
rasterizer.clip_box(std::max(int(mpl_round(l)), 0),
447-
std::max(int(height) - int(mpl_round(b)), 0),
448-
std::min(int(mpl_round(r)), int(width)),
449-
std::min(int(height) - int(mpl_round(t)), int(height)));
446+
rasterizer.clip_box(std::max(int(floor(l - 0.5)), 0),
447+
std::max(int(floor(height - b - 0.5)), 0),
448+
std::min(int(floor(r - 0.5)), int(width)),
449+
std::min(int(floor(height - t - 0.5)), int(height)));
450450
}
451451
else
452452
{
@@ -660,7 +660,7 @@ RendererAgg::draw_markers(const Py::Tuple& args)
660660
// Deal with the difference in y-axis direction
661661
marker_trans *= agg::trans_affine_scaling(1.0, -1.0);
662662
trans *= agg::trans_affine_scaling(1.0, -1.0);
663-
trans *= agg::trans_affine_translation(0.0, (double)height);
663+
trans *= agg::trans_affine_translation(0.5, (double)height + 0.5);
664664

665665
PathIterator marker_path(marker_path_obj);
666666
transformed_path_t marker_path_transformed(marker_path, marker_trans);
@@ -746,8 +746,8 @@ RendererAgg::draw_markers(const Py::Tuple& args)
746746
continue;
747747
}
748748

749-
x = (double)(int)x;
750-
y = (double)(int)y;
749+
x = floor(x);
750+
y = floor(y);
751751

752752
// Cull points outside the boundary of the image.
753753
// Values that are too large may overflow and create
@@ -782,8 +782,8 @@ RendererAgg::draw_markers(const Py::Tuple& args)
782782
continue;
783783
}
784784

785-
x = (double)(int)x;
786-
y = (double)(int)y;
785+
x = floor(x);
786+
y = floor(y);
787787

788788
// Cull points outside the boundary of the image.
789789
// Values that are too large may overflow and create

src/path_converters.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,8 @@ class PathSnapper
494494
code = m_source->vertex(x, y);
495495
if (m_snap && agg::is_vertex(code))
496496
{
497-
*x = mpl_round(*x) + m_snap_value;
498-
*y = mpl_round(*y) + m_snap_value;
497+
*x = floor(*x - m_snap_value) + m_snap_value;
498+
*y = floor(*y - m_snap_value) + m_snap_value;
499499
}
500500
return code;
501501
}

0 commit comments

Comments
 (0)