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

Commit61f0eea

Browse files
committed
Merge pull request#5307 from mdboom/lower-tolerance
Lower test tolerance
2 parentse75b44a +727aacb commit61f0eea

File tree

1,547 files changed

+249975
-308266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,547 files changed

+249975
-308266
lines changed

‎examples/api/custom_projection_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def __init__(self, round_to=1.0):
294294
self._round_to=round_to
295295

296296
def__call__(self,x,pos=None):
297-
degrees=round(np.degrees(x)/self._round_to)*self._round_to
297+
degrees=np.round(np.degrees(x)/self._round_to)*self._round_to
298298
# \u00b0 : degree symbol
299299
return"%d\u00b0"%degrees
300300

‎lib/matplotlib/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,7 @@ def tk_window_focus():
14481448
'matplotlib.tests.test_contour',
14491449
'matplotlib.tests.test_dates',
14501450
'matplotlib.tests.test_delaunay',
1451+
'matplotlib.tests.test_dviread',
14511452
'matplotlib.tests.test_figure',
14521453
'matplotlib.tests.test_font_manager',
14531454
'matplotlib.tests.test_gridspec',
@@ -1477,6 +1478,7 @@ def tk_window_focus():
14771478
'matplotlib.tests.test_tightlayout',
14781479
'matplotlib.tests.test_transforms',
14791480
'matplotlib.tests.test_triangulation',
1481+
'matplotlib.tests.test_type1font',
14801482
'matplotlib.tests.test_units',
14811483
'matplotlib.tests.test_widgets',
14821484
'matplotlib.tests.test_cycles',

‎lib/matplotlib/axes/_base.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
frommatplotlib.externalsimportsix
55
frommatplotlib.externals.six.movesimportxrange
66

7+
fromcollectionsimportOrderedDict
78
importitertools
89
importwarnings
910
importmath
@@ -903,11 +904,11 @@ def _gen_axes_spines(self, locations=None, offset=0.0, units='inches'):
903904
Intended to be overridden by new projection types.
904905
905906
"""
906-
return{
907-
'left':mspines.Spine.linear_spine(self,'left'),
908-
'right':mspines.Spine.linear_spine(self,'right'),
909-
'bottom':mspines.Spine.linear_spine(self,'bottom'),
910-
'top':mspines.Spine.linear_spine(self,'top'), }
907+
returnOrderedDict([
908+
('left',mspines.Spine.linear_spine(self,'left')),
909+
('right',mspines.Spine.linear_spine(self,'right')),
910+
('bottom',mspines.Spine.linear_spine(self,'bottom')),
911+
('top',mspines.Spine.linear_spine(self,'top'))])
911912

912913
defcla(self):
913914
"""Clear the current axes."""
@@ -2341,8 +2342,8 @@ def draw(self, renderer=None, inframe=False):
23412342
forz,iminzorder_images]
23422343

23432344
l,b,r,t=self.bbox.extents
2344-
width=int(mag* ((round(r)+0.5)- (round(l)-0.5)))
2345-
height=int(mag* ((round(t)+0.5)- (round(b)-0.5)))
2345+
width=int(mag* ((np.round(r)+0.5)- (np.round(l)-0.5)))
2346+
height=int(mag* ((np.round(t)+0.5)- (np.round(b)-0.5)))
23462347
im=mimage.from_images(height,
23472348
width,
23482349
ims)

‎lib/matplotlib/backends/backend_agg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ def draw_mathtext(self, gc, x, y, s, prop, angle):
176176

177177
xd=descent*sin(radians(angle))
178178
yd=descent*cos(radians(angle))
179-
x=round(x+ox+xd)
180-
y=round(y-oy+yd)
179+
x=np.round(x+ox+xd)
180+
y=np.round(y-oy+yd)
181181
self._renderer.draw_text_image(font_image,x,y+1,angle,gc)
182182

183183
defdraw_text(self,gc,x,y,s,prop,angle,ismath=False,mtext=None):

‎lib/matplotlib/backends/backend_cairo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def set_clip_rectangle(self, rectangle):
359359
ifnotrectangle:return
360360
x,y,w,h=rectangle.bounds
361361
# pixel-aligned clip-regions are faster
362-
x,y,w,h=round(x),round(y),round(w),round(h)
362+
x,y,w,h=np.round(x),np.round(y),np.round(w),np.round(h)
363363
ctx=self.ctx
364364
ctx.new_path()
365365
ctx.rectangle (x,self.renderer.height-h-y,w,h)

‎lib/matplotlib/backends/backend_gdk.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def draw_path(self, gc, path, transform, rgbFace=None):
9191
forpolygoninpolygons:
9292
# draw_polygon won't take an arbitrary sequence -- it must be a list
9393
# of tuples
94-
polygon= [(int(round(x)),int(round(y)))forx,yinpolygon]
94+
polygon= [(int(np.round(x)),int(np.round(y)))forx,yinpolygon]
9595
ifrgbFaceisnotNone:
9696
saveColor=gc.gdkGC.foreground
9797
gc.gdkGC.foreground=gc.rgb_to_gdk_color(rgbFace)
@@ -281,7 +281,7 @@ def _get_pango_layout(self, s, prop):
281281
returnvalue
282282

283283
size=prop.get_size_in_points()*self.dpi/96.0
284-
size=round(size)
284+
size=np.round(size)
285285

286286
font_str='%s, %s %i'% (prop.get_name(),prop.get_style(),size,)
287287
font=pango.FontDescription(font_str)
@@ -387,7 +387,7 @@ def set_dashes(self, dash_offset, dash_list):
387387
self.gdkGC.line_style=gdk.LINE_SOLID
388388
else:
389389
pixels=self.renderer.points_to_pixels(np.asarray(dash_list))
390-
dl= [max(1,int(round(val)))forvalinpixels]
390+
dl= [max(1,int(np.round(val)))forvalinpixels]
391391
self.gdkGC.set_dashes(dash_offset,dl)
392392
self.gdkGC.line_style=gdk.LINE_ON_OFF_DASH
393393

@@ -413,7 +413,7 @@ def set_linewidth(self, w):
413413
self.gdkGC.line_width=0
414414
else:
415415
pixels=self.renderer.points_to_pixels(w)
416-
self.gdkGC.line_width=max(1,int(round(pixels)))
416+
self.gdkGC.line_width=max(1,int(np.round(pixels)))
417417

418418

419419
defnew_figure_manager(num,*args,**kwargs):

‎lib/matplotlib/backends/backend_pdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ def cvt(length, upe=font.units_per_EM, nearest=True):
824824
"Convert font coordinates to PDF glyph coordinates"
825825
value=length/upe*1000
826826
ifnearest:
827-
returnround(value)
827+
returnnp.round(value)
828828
# Perhaps best to round away from zero for bounding
829829
# boxes and the like
830830
ifvalue<0:

‎lib/matplotlib/backends/backend_ps.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,8 +1171,6 @@ def print_figure_impl():
11711171
print("%s translate"%_nums_to_str(xo,yo),file=fh)
11721172
ifrotation:print("%d rotate"%rotation,file=fh)
11731173
print("%s clipbox"%_nums_to_str(width*72,height*72,0,0),file=fh)
1174-
# Disable any sort of miter limit
1175-
print("%s setmiterlimit"%100000,file=fh)
11761174

11771175
# write the figure
11781176
content=self._pswriter.getvalue()
@@ -1322,8 +1320,6 @@ def write(self, *kl, **kwargs):
13221320
#print >>fh, "gsave"
13231321
print("%s translate"%_nums_to_str(xo,yo),file=fh)
13241322
print("%s clipbox"%_nums_to_str(width*72,height*72,0,0),file=fh)
1325-
# Disable any sort of miter limit
1326-
print("%d setmiterlimit"%100000,file=fh)
13271323

13281324
# write the figure
13291325
print(self._pswriter.getvalue(),file=fh)

‎lib/matplotlib/backends/backend_svg.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
frommatplotlib.externals.siximportunichr
77

88
importos,base64,tempfile,gzip,io,sys,codecs,re
9+
fromcollectionsimportOrderedDict
910

1011
importnumpyasnp
1112

@@ -231,7 +232,7 @@ def generate_transform(transform_list=[]):
231232
iftype=='matrix'andisinstance(value,Affine2DBase):
232233
value=value.to_values()
233234

234-
output.write('%s(%s)'% (type,' '.join(str(x)forxinvalue)))
235+
output.write('%s(%s)'% (type,' '.join('%f'%xforxinvalue)))
235236
returnoutput.getvalue()
236237
return''
237238

@@ -263,15 +264,15 @@ def __init__(self, width, height, svgwriter, basename=None, image_dpi=72):
263264
assertbasenameisnotNone
264265
self.basename=basename
265266
self._imaged= {}
266-
self._clipd={}
267+
self._clipd=OrderedDict()
267268
self._char_defs= {}
268269
self._markers= {}
269270
self._path_collection_id=0
270271
self._imaged= {}
271-
self._hatchd={}
272+
self._hatchd=OrderedDict()
272273
self._has_gouraud=False
273274
self._n_gradients=0
274-
self._fonts={}
275+
self._fonts=OrderedDict()
275276
self.mathtext_parser=MathTextParser('SVG')
276277

277278
RendererBase.__init__(self)
@@ -298,10 +299,7 @@ def _write_default_style(self):
298299
writer=self.writer
299300
default_style=generate_css({
300301
'stroke-linejoin':'round',
301-
'stroke-linecap':'butt',
302-
# Disable the miter limit. 100000 seems to be close to
303-
# the maximum that renderers support before breaking.
304-
'stroke-miterlimit':'100000'})
302+
'stroke-linecap':'butt'})
305303
writer.start('defs')
306304
writer.start('style',type='text/css')
307305
writer.data('*{%s}\n'%default_style)
@@ -403,18 +401,18 @@ def _get_style_dict(self, gc, rgbFace):
403401
ifgc.get_hatch()isnotNone:
404402
attrib['fill']="url(#%s)"%self._get_hatch(gc,rgbFace)
405403
ifrgbFaceisnotNoneandlen(rgbFace)==4andrgbFace[3]!=1.0andnotforced_alpha:
406-
attrib['fill-opacity']=str(rgbFace[3])
404+
attrib['fill-opacity']="%f"%rgbFace[3]
407405
else:
408406
ifrgbFaceisNone:
409407
attrib['fill']='none'
410408
else:
411409
iftuple(rgbFace[:3])!= (0,0,0):
412410
attrib['fill']=rgb2hex(rgbFace)
413411
iflen(rgbFace)==4andrgbFace[3]!=1.0andnotforced_alpha:
414-
attrib['fill-opacity']=str(rgbFace[3])
412+
attrib['fill-opacity']="%f"%rgbFace[3]
415413

416414
ifforced_alphaandgc.get_alpha()!=1.0:
417-
attrib['opacity']=str(gc.get_alpha())
415+
attrib['opacity']="%f"%gc.get_alpha()
418416

419417
offset,seq=gc.get_dashes()
420418
ifseqisnotNone:
@@ -426,9 +424,9 @@ def _get_style_dict(self, gc, rgbFace):
426424
rgb=gc.get_rgb()
427425
attrib['stroke']=rgb2hex(rgb)
428426
ifnotforced_alphaandrgb[3]!=1.0:
429-
attrib['stroke-opacity']=str(rgb[3])
427+
attrib['stroke-opacity']="%f"%rgb[3]
430428
iflinewidth!=1.0:
431-
attrib['stroke-width']=str(linewidth)
429+
attrib['stroke-width']="%f"%linewidth
432430
ifgc.get_joinstyle()!='round':
433431
attrib['stroke-linejoin']=gc.get_joinstyle()
434432
ifgc.get_capstyle()!='butt':
@@ -756,7 +754,7 @@ def draw_gouraud_triangle(self, gc, points, colors, trans):
756754
'use',
757755
attrib={'xlink:href':href,
758756
'fill':rgb2hex(avg_color),
759-
'fill-opacity':str(avg_color[-1])})
757+
'fill-opacity':"%f"%avg_color[-1]})
760758
foriinrange(3):
761759
writer.element(
762760
'use',
@@ -842,7 +840,7 @@ def draw_image(self, gc, x, y, im, dx=None, dy=None, transform=None):
842840

843841
alpha=gc.get_alpha()
844842
ifalpha!=1.0:
845-
attrib['opacity']=str(alpha)
843+
attrib['opacity']="%f"%alpha
846844

847845
attrib['id']=oid
848846

@@ -1048,8 +1046,8 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
10481046
'center':'middle'}
10491047
style['text-anchor']=ha_mpl_to_svg[mtext.get_ha()]
10501048

1051-
attrib['x']=str(ax)
1052-
attrib['y']=str(ay)
1049+
attrib['x']="%f"%ax
1050+
attrib['y']="%f"%ay
10531051
attrib['style']=generate_css(style)
10541052
attrib['transform']="rotate(%f, %f, %f)"% (-angle,ax,ay)
10551053
writer.element('text',s,attrib=attrib)
@@ -1087,7 +1085,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
10871085

10881086
# Sort the characters by font, and output one tspan for
10891087
# each
1090-
spans={}
1088+
spans=OrderedDict()
10911089
forfont,fontsize,thetext,new_x,new_y,metricsinsvg_glyphs:
10921090
style=generate_css({
10931091
'font-size':six.text_type(fontsize)+'px',
@@ -1103,7 +1101,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
11031101
fontset=self._fonts.setdefault(font.fname,set())
11041102
fontset.add(thetext)
11051103

1106-
forstyle,charsinlist(six.iteritems(spans)):
1104+
forstyle,charsinsix.iteritems(spans):
11071105
chars.sort()
11081106

11091107
same_y=True

‎lib/matplotlib/dates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ def __init__(self, t, fmt, tz=None):
609609

610610
def__call__(self,x,pos=0):
611611
'Return the label for time *x* at position *pos*'
612-
ind=int(round(x))
612+
ind=int(np.round(x))
613613
ifind>=len(self.t)orind<=0:
614614
return''
615615

‎lib/matplotlib/image.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -650,10 +650,10 @@ def make_image(self, magnification=1.0):
650650
im.apply_translation(tx,ty)
651651

652652
l,b,r,t=self.axes.bbox.extents
653-
widthDisplay= ((round(r*magnification)+0.5)-
654-
(round(l*magnification)-0.5))
655-
heightDisplay= ((round(t*magnification)+0.5)-
656-
(round(b*magnification)-0.5))
653+
widthDisplay= ((np.round(r*magnification)+0.5)-
654+
(np.round(l*magnification)-0.5))
655+
heightDisplay= ((np.round(t*magnification)+0.5)-
656+
(np.round(b*magnification)-0.5))
657657

658658
# resize viewport to display
659659
rx=widthDisplay/numcols
@@ -773,8 +773,8 @@ def make_image(self, magnification=1.0):
773773

774774
x0,y0,v_width,v_height=self.axes.viewLim.bounds
775775
l,b,r,t=self.axes.bbox.extents
776-
width= (round(r)+0.5)- (round(l)-0.5)
777-
height= (round(t)+0.5)- (round(b)-0.5)
776+
width= (np.round(r)+0.5)- (np.round(l)-0.5)
777+
height= (np.round(t)+0.5)- (np.round(b)-0.5)
778778
width*=magnification
779779
height*=magnification
780780
im=_image.pcolor(self._Ax,self._Ay,A,
@@ -897,11 +897,11 @@ def make_image(self, magnification=1.0):
897897
bg=mcolors.colorConverter.to_rgba(fc,0)
898898
bg= (np.array(bg)*255).astype(np.uint8)
899899
l,b,r,t=self.axes.bbox.extents
900-
width= (round(r)+0.5)- (round(l)-0.5)
901-
height= (round(t)+0.5)- (round(b)-0.5)
900+
width= (np.round(r)+0.5)- (np.round(l)-0.5)
901+
height= (np.round(t)+0.5)- (np.round(b)-0.5)
902902
# The extra cast-to-int is only needed for python2
903-
width=int(round(width*magnification))
904-
height=int(round(height*magnification))
903+
width=int(np.round(width*magnification))
904+
height=int(np.round(height*magnification))
905905
ifself._rgbacacheisNone:
906906
A=self.to_rgba(self._A,bytes=True)
907907
self._rgbacache=A
@@ -932,8 +932,8 @@ def draw(self, renderer, *args, **kwargs):
932932
gc.set_clip_path(self.get_clip_path())
933933
gc.set_alpha(self.get_alpha())
934934
renderer.draw_image(gc,
935-
round(self.axes.bbox.xmin),
936-
round(self.axes.bbox.ymin),
935+
np.round(self.axes.bbox.xmin),
936+
np.round(self.axes.bbox.ymin),
937937
im)
938938
gc.restore()
939939
self.stale=False
@@ -1093,7 +1093,7 @@ def draw(self, renderer, *args, **kwargs):
10931093
gc.set_clip_rectangle(self.figure.bbox)
10941094
gc.set_clip_path(self.get_clip_path())
10951095
gc.set_alpha(self.get_alpha())
1096-
renderer.draw_image(gc,round(self.ox),round(self.oy),im)
1096+
renderer.draw_image(gc,np.round(self.ox),np.round(self.oy),im)
10971097
gc.restore()
10981098
self.stale=False
10991099

@@ -1212,8 +1212,8 @@ def make_image(self, renderer, magnification=1.0):
12121212
im.set_resample(self._resample)
12131213

12141214
l,b,r,t=self.get_window_extent(renderer).extents# bbox.extents
1215-
widthDisplay=abs(round(r)-round(l))
1216-
heightDisplay=abs(round(t)-round(b))
1215+
widthDisplay=abs(np.round(r)-np.round(l))
1216+
heightDisplay=abs(np.round(t)-np.round(b))
12171217
widthDisplay*=magnification
12181218
heightDisplay*=magnification
12191219

@@ -1245,7 +1245,7 @@ def draw(self, renderer, *args, **kwargs):
12451245

12461246
l=np.min([x0,x1])
12471247
b=np.min([y0,y1])
1248-
renderer.draw_image(gc,round(l),round(b),im)
1248+
renderer.draw_image(gc,np.round(l),np.round(b),im)
12491249
gc.restore()
12501250
self.stale=True
12511251

‎lib/matplotlib/mathtext.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
importmatplotlib.colorsasmcolors
6262
importmatplotlib._pngas_png
63+
6364
####################
6465

6566

@@ -2120,10 +2121,10 @@ def hlist_out(self, box):
21202121
ifglue_sign==1:# stretching
21212122
ifglue_spec.stretch_order==glue_order:
21222123
cur_glue+=glue_spec.stretch
2123-
cur_g=round(clamp(float(box.glue_set)*cur_glue))
2124+
cur_g=np.round(clamp(float(box.glue_set)*cur_glue))
21242125
elifglue_spec.shrink_order==glue_order:
21252126
cur_glue+=glue_spec.shrink
2126-
cur_g=round(clamp(float(box.glue_set)*cur_glue))
2127+
cur_g=np.round(clamp(float(box.glue_set)*cur_glue))
21272128
rule_width+=cur_g
21282129
self.cur_h+=rule_width
21292130
self.cur_s-=1
@@ -2176,10 +2177,10 @@ def vlist_out(self, box):
21762177
ifglue_sign==1:# stretching
21772178
ifglue_spec.stretch_order==glue_order:
21782179
cur_glue+=glue_spec.stretch
2179-
cur_g=round(clamp(float(box.glue_set)*cur_glue))
2180+
cur_g=np.round(clamp(float(box.glue_set)*cur_glue))
21802181
elifglue_spec.shrink_order==glue_order:# shrinking
21812182
cur_glue+=glue_spec.shrink
2182-
cur_g=round(clamp(float(box.glue_set)*cur_glue))
2183+
cur_g=np.round(clamp(float(box.glue_set)*cur_glue))
21832184
rule_height+=cur_g
21842185
self.cur_v+=rule_height
21852186
elifisinstance(p,Char):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp