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

Skip to content

Commit e7f1e83

Browse files
committed
Fix bug where there was a thin semitransparent line on the upper and left edge of the image in the Agg backend. Closes #117.
1 parent 0cc213b commit e7f1e83

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/matplotlib/figure.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def __init__(self,
226226
dpi = None, # defaults to rc figure.dpi
227227
facecolor = None, # defaults to rc figure.facecolor
228228
edgecolor = None, # defaults to rc figure.edgecolor
229-
linewidth = 1.0, # the default linewidth of the frame
229+
linewidth = 0.0, # the default linewidth of the frame
230230
frameon = True, # whether or not to draw the figure frame
231231
subplotpars = None, # default to rc
232232
):
@@ -271,6 +271,7 @@ def __init__(self,
271271
linewidth=linewidth,
272272
)
273273
self._set_artist_props(self.patch)
274+
self.patch.set_aa(False)
274275

275276
self._hold = rcParams['axes.hold']
276277
self.canvas = None

src/_backend_agg.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,11 +1317,15 @@ RendererAgg::draw_path(const Py::Tuple& args)
13171317
trans *= agg::trans_affine_translation(0.0, (double)height);
13181318
bool clip = !face.first && gc.hatchpath.isNone() && !path.has_curves();
13191319
bool simplify = path.should_simplify() && clip;
1320+
double snapping_linewidth = gc.linewidth;
1321+
if (gc.color.a == 1.0) {
1322+
snapping_linewidth = 0.0;
1323+
}
13201324

13211325
transformed_path_t tpath(path, trans);
13221326
nan_removed_t nan_removed(tpath, true, path.has_curves());
13231327
clipped_t clipped(nan_removed, clip, width, height);
1324-
snapped_t snapped(clipped, gc.snap_mode, path.total_vertices(), gc.linewidth);
1328+
snapped_t snapped(clipped, gc.snap_mode, path.total_vertices(), snapping_linewidth);
13251329
simplify_t simplified(snapped, simplify, path.simplify_threshold());
13261330
curve_t curve(simplified);
13271331

0 commit comments

Comments
 (0)