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

Commit164222a

Browse files
tacaswellmdboom
authored andcommitted
Merge pull request#5307 from mdboom/lower-tolerance
Lower test tolerance
1 parentcc34fb4 commit164222a

File tree

1,546 files changed

+246817
-298860
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,546 files changed

+246817
-298860
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
@@ -1444,6 +1444,7 @@ def tk_window_focus():
14441444
'matplotlib.tests.test_contour',
14451445
'matplotlib.tests.test_dates',
14461446
'matplotlib.tests.test_delaunay',
1447+
'matplotlib.tests.test_dviread',
14471448
'matplotlib.tests.test_figure',
14481449
'matplotlib.tests.test_font_manager',
14491450
'matplotlib.tests.test_gridspec',
@@ -1473,6 +1474,7 @@ def tk_window_focus():
14731474
'matplotlib.tests.test_tightlayout',
14741475
'matplotlib.tests.test_transforms',
14751476
'matplotlib.tests.test_triangulation',
1477+
'matplotlib.tests.test_type1font',
14761478
'matplotlib.tests.test_units',
14771479
'matplotlib.tests.test_widgets',
14781480
'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
@@ -175,8 +175,8 @@ def draw_mathtext(self, gc, x, y, s, prop, angle):
175175

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

182182
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: 7 additions & 9 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

@@ -271,15 +272,15 @@ def __init__(self, width, height, svgwriter, basename=None, image_dpi=72):
271272
assertbasenameisnotNone
272273
self.basename=basename
273274
self._imaged= {}
274-
self._clipd={}
275+
self._clipd=OrderedDict()
275276
self._char_defs= {}
276277
self._markers= {}
277278
self._path_collection_id=0
278279
self._imaged= {}
279-
self._hatchd={}
280+
self._hatchd=OrderedDict()
280281
self._has_gouraud=False
281282
self._n_gradients=0
282-
self._fonts={}
283+
self._fonts=OrderedDict()
283284
self.mathtext_parser=MathTextParser('SVG')
284285

285286
RendererBase.__init__(self)
@@ -306,10 +307,7 @@ def _write_default_style(self):
306307
writer=self.writer
307308
default_style=generate_css({
308309
'stroke-linejoin':'round',
309-
'stroke-linecap':'butt',
310-
# Disable the miter limit. 100000 seems to be close to
311-
# the maximum that renderers support before breaking.
312-
'stroke-miterlimit':'100000'})
310+
'stroke-linecap':'butt'})
313311
writer.start('defs')
314312
writer.start('style',type='text/css')
315313
writer.data('*{%s}\n'%default_style)
@@ -1104,7 +1102,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
11041102

11051103
# Sort the characters by font, and output one tspan for
11061104
# each
1107-
spans={}
1105+
spans=OrderedDict()
11081106
forfont,fontsize,thetext,new_x,new_y,metricsinsvg_glyphs:
11091107
style=generate_css({
11101108
'font-size':short_float_fmt(fontsize)+'px',
@@ -1120,7 +1118,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
11201118
fontset=self._fonts.setdefault(font.fname,set())
11211119
fontset.add(thetext)
11221120

1123-
forstyle,charsinlist(six.iteritems(spans)):
1121+
forstyle,charsinsix.iteritems(spans):
11241122
chars.sort()
11251123

11261124
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):

‎lib/matplotlib/mlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2215,7 +2215,7 @@ def frange(xini, xfin=None, delta=None, **kw):
22152215
npts=kw['npts']
22162216
delta= (xfin-xini)/float(npts-endpoint)
22172217
exceptKeyError:
2218-
npts=int(round((xfin-xini)/delta))+endpoint
2218+
npts=int(np.round((xfin-xini)/delta))+endpoint
22192219
# round finds the nearest, so the endpoint can be up to
22202220
# delta/2 larger than xfin.
22212221

‎lib/matplotlib/mpl-data/stylelib/classic.mplstyle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ boxplot.flierprops.linestyle: none
329329
boxplot.flierprops.linewidth: 1.0
330330
boxplot.flierprops.marker: +
331331
boxplot.flierprops.markeredgecolor: k
332-
boxplot.flierprops.markerfacecolor:b
332+
boxplot.flierprops.markerfacecolor:auto
333333
boxplot.flierprops.markersize: 6.0
334334
boxplot.meanline: False
335335
boxplot.meanprops.color: r

‎lib/matplotlib/patches.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,9 +2291,9 @@ def _get_sawtooth_vertices(self, x0, y0, width, height, mutation_size):
22912291

22922292
# the sizes of the vertical and horizontal sawtooth are
22932293
# separately adjusted to fit the given box size.
2294-
dsx_n=int(round((width-tooth_size)/ (tooth_size*2)))*2
2294+
dsx_n=int(np.round((width-tooth_size)/ (tooth_size*2)))*2
22952295
dsx= (width-tooth_size)/dsx_n
2296-
dsy_n=int(round((height-tooth_size)/ (tooth_size*2)))*2
2296+
dsy_n=int(np.round((height-tooth_size)/ (tooth_size*2)))*2
22972297
dsy= (height-tooth_size)/dsy_n
22982298

22992299
x0,y0=x0-pad+tooth_size2,y0-pad+tooth_size2

‎lib/matplotlib/projections/geo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(self, round_to=1.0):
3434

3535
def__call__(self,x,pos=None):
3636
degrees= (x/np.pi)*180.0
37-
degrees=round(degrees/self._round_to)*self._round_to
37+
degrees=np.round(degrees/self._round_to)*self._round_to
3838
ifrcParams['text.usetex']andnotrcParams['text.latex.unicode']:
3939
returnr"$%0.0f^\circ$"%degrees
4040
else:

‎lib/matplotlib/rcsetup.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,12 @@ def validate_color_or_inherit(s):
313313
returnvalidate_color(s)
314314

315315

316+
defvalidate_color_or_auto(s):
317+
ifs=='auto':
318+
returns
319+
returnvalidate_color(s)
320+
321+
316322
defvalidate_color(s):
317323
'return a valid color arg'
318324
try:
@@ -847,7 +853,7 @@ def validate_hist_bins(s):
847853

848854
'boxplot.flierprops.color': ['b',validate_color],
849855
'boxplot.flierprops.marker': ['+',six.text_type],
850-
'boxplot.flierprops.markerfacecolor': ['b',validate_color],
856+
'boxplot.flierprops.markerfacecolor': ['auto',validate_color_or_auto],
851857
'boxplot.flierprops.markeredgecolor': ['k',validate_color],
852858
'boxplot.flierprops.markersize': [6,validate_float],
853859
'boxplot.flierprops.linestyle': ['none',six.text_type],

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp