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

Commitce900fd

Browse files
committed
Make private collection attributes singular
1 parente394940 commitce900fd

File tree

4 files changed

+66
-66
lines changed

4 files changed

+66
-66
lines changed

‎lib/matplotlib/collections.py

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ def __init__(self, *,
156156
cm.ScalarMappable.__init__(self,norm,cmap)
157157
# list of un-scaled dash patterns
158158
# this is needed scaling the dash pattern by linewidth
159-
self._us_linestyles= [(0,None)]
159+
self._us_linestyle= [(0,None)]
160160
# list of dash patterns
161-
self._linestyles= [(0,None)]
161+
self._linestyle= [(0,None)]
162162
# list of unbroadcast/scaled linewidths
163163
self._us_lw= [0]
164-
self._linewidths= [0]
164+
self._linewidth= [0]
165165

166166
self._gapcolor=None# Currently only used by LineCollection.
167167

@@ -380,9 +380,9 @@ def draw(self, renderer):
380380
do_single_path_optimization=False
381381
if (len(paths)==1andlen(trans)<=1and
382382
len(facecolors)==1andlen(edgecolors)==1and
383-
len(self._linewidths)==1and
384-
all(ls[1]isNoneforlsinself._linestyles)and
385-
len(self._antialiaseds)==1andlen(self._urls)==1and
383+
len(self._linewidth)==1and
384+
all(ls[1]isNoneforlsinself._linestyle)and
385+
len(self._antialiased)==1andlen(self._urls)==1and
386386
self.get_hatch()isNone):
387387
iflen(trans):
388388
combined_transform=transforms.Affine2D(trans[0])+transform
@@ -401,31 +401,31 @@ def draw(self, renderer):
401401

402402
ifdo_single_path_optimization:
403403
gc.set_foreground(tuple(edgecolors[0]))
404-
gc.set_linewidth(self._linewidths[0])
405-
gc.set_dashes(*self._linestyles[0])
406-
gc.set_antialiased(self._antialiaseds[0])
404+
gc.set_linewidth(self._linewidth[0])
405+
gc.set_dashes(*self._linestyle[0])
406+
gc.set_antialiased(self._antialiased[0])
407407
gc.set_url(self._urls[0])
408408
renderer.draw_markers(
409409
gc,paths[0],combined_transform.frozen(),
410410
mpath.Path(offsets),offset_trf,tuple(facecolors[0]))
411411
else:
412412
ifself._gapcolorisnotNone:
413413
# First draw paths within the gaps.
414-
ipaths,ilinestyles=self._get_inverse_paths_linestyles()
414+
ipaths,ilinestyles=self._get_inverse_paths_linestyle()
415415
renderer.draw_path_collection(
416416
gc,transform.frozen(),ipaths,
417417
self.get_transforms(),offsets,offset_trf,
418418
[mcolors.to_rgba("none")],self._gapcolor,
419-
self._linewidths,ilinestyles,
420-
self._antialiaseds,self._urls,
419+
self._linewidth,ilinestyles,
420+
self._antialiased,self._urls,
421421
"screen")
422422

423423
renderer.draw_path_collection(
424424
gc,transform.frozen(),paths,
425425
self.get_transforms(),offsets,offset_trf,
426426
self.get_facecolor(),self.get_edgecolor(),
427-
self._linewidths,self._linestyles,
428-
self._antialiaseds,self._urls,
427+
self._linewidth,self._linestyle,
428+
self._antialiased,self._urls,
429429
"screen")# offset_position, kept for backcompat.
430430

431431
gc.restore()
@@ -584,8 +584,8 @@ def set_linewidth(self, lw):
584584
self._us_lw=np.atleast_1d(lw)
585585

586586
# scale all of the dash patterns.
587-
self._linewidths,self._linestyles=self._bcast_lwls(
588-
self._us_lw,self._us_linestyles)
587+
self._linewidth,self._linestyle=self._bcast_lwls(
588+
self._us_lw,self._us_linestyle)
589589
self.stale=True
590590

591591
defset_linestyle(self,ls):
@@ -624,11 +624,11 @@ def set_linestyle(self, ls):
624624
raiseValueError(emsg)fromerr
625625

626626
# get the list of raw 'unscaled' dash patterns
627-
self._us_linestyles=dashes
627+
self._us_linestyle=dashes
628628

629629
# broadcast and scale the lw and dash patterns
630-
self._linewidths,self._linestyles=self._bcast_lwls(
631-
self._us_lw,self._us_linestyles)
630+
self._linewidth,self._linestyle=self._bcast_lwls(
631+
self._us_lw,self._us_linestyle)
632632

633633
@_docstring.interpd
634634
defset_capstyle(self,cs):
@@ -732,7 +732,7 @@ def set_antialiased(self, aa):
732732
"""
733733
ifaaisNone:
734734
aa=self._get_default_antialiased()
735-
self._antialiaseds=np.atleast_1d(np.asarray(aa,bool))
735+
self._antialiased=np.atleast_1d(np.asarray(aa,bool))
736736
self.stale=True
737737

738738
def_get_default_antialiased(self):
@@ -763,7 +763,7 @@ def _set_facecolor(self, c):
763763
ifcisNone:
764764
c=self._get_default_facecolor()
765765

766-
self._facecolors=mcolors.to_rgba_array(c,self._alpha)
766+
self._facecolor=mcolors.to_rgba_array(c,self._alpha)
767767
self.stale=True
768768

769769
defset_facecolor(self,c):
@@ -784,13 +784,13 @@ def set_facecolor(self, c):
784784
self._set_facecolor(c)
785785

786786
defget_facecolor(self):
787-
returnself._facecolors
787+
returnself._facecolor
788788

789789
defget_edgecolor(self):
790-
ifcbook._str_equal(self._edgecolors,'face'):
790+
ifcbook._str_equal(self._edgecolor,'face'):
791791
returnself.get_facecolor()
792792
else:
793-
returnself._edgecolors
793+
returnself._edgecolor
794794

795795
def_get_default_edgecolor(self):
796796
# This may be overridden in a subclass.
@@ -807,12 +807,12 @@ def _set_edgecolor(self, c):
807807
c='none'
808808
set_hatch_color=False
809809
ifcbook._str_lower_equal(c,'face'):
810-
self._edgecolors='face'
810+
self._edgecolor='face'
811811
self.stale=True
812812
return
813-
self._edgecolors=mcolors.to_rgba_array(c,self._alpha)
814-
ifset_hatch_colorandlen(self._edgecolors):
815-
self._hatch_color=tuple(self._edgecolors[0])
813+
self._edgecolor=mcolors.to_rgba_array(c,self._alpha)
814+
ifset_hatch_colorandlen(self._edgecolor):
815+
self._hatch_color=tuple(self._edgecolor[0])
816816
self.stale=True
817817

818818
defset_edgecolor(self,c):
@@ -852,10 +852,10 @@ def set_alpha(self, alpha):
852852
set_alpha.__doc__=artist.Artist._set_alpha_for_array.__doc__
853853

854854
defget_linewidth(self):
855-
returnself._linewidths
855+
returnself._linewidth
856856

857857
defget_linestyle(self):
858-
returnself._linestyles
858+
returnself._linestyle
859859

860860
def_set_mappable_flags(self):
861861
"""
@@ -920,11 +920,11 @@ def update_scalarmappable(self):
920920
self._mapped_colors=self.to_rgba(self._A,self._alpha)
921921

922922
ifself._face_is_mapped:
923-
self._facecolors=self._mapped_colors
923+
self._facecolor=self._mapped_colors
924924
else:
925925
self._set_facecolor(self._original_facecolor)
926926
ifself._edge_is_mapped:
927-
self._edgecolors=self._mapped_colors
927+
self._edgecolor=self._mapped_colors
928928
else:
929929
self._set_edgecolor(self._original_edgecolor)
930930
self.stale=True
@@ -937,17 +937,17 @@ def update_from(self, other):
937937
"""Copy properties from other to self."""
938938

939939
artist.Artist.update_from(self,other)
940-
self._antialiaseds=other._antialiaseds
940+
self._antialiased=other._antialiased
941941
self._mapped_colors=other._mapped_colors
942942
self._edge_is_mapped=other._edge_is_mapped
943943
self._original_edgecolor=other._original_edgecolor
944-
self._edgecolors=other._edgecolors
944+
self._edgecolor=other._edgecolor
945945
self._face_is_mapped=other._face_is_mapped
946946
self._original_facecolor=other._original_facecolor
947-
self._facecolors=other._facecolors
948-
self._linewidths=other._linewidths
949-
self._linestyles=other._linestyles
950-
self._us_linestyles=other._us_linestyles
947+
self._facecolor=other._facecolor
948+
self._linewidth=other._linewidth
949+
self._linestyle=other._linestyle
950+
self._us_linestyle=other._us_linestyle
951951
self._pickradius=other._pickradius
952952
self._hatch=other._hatch
953953

@@ -1465,7 +1465,7 @@ def set_color(self, c):
14651465
set_colors=set_color
14661466

14671467
defget_color(self):
1468-
returnself._edgecolors
1468+
returnself._edgecolor
14691469

14701470
get_colors=get_color# for compatibility with old versions
14711471

@@ -1499,7 +1499,7 @@ def _set_gapcolor(self, gapcolor):
14991499
defget_gapcolor(self):
15001500
returnself._gapcolor
15011501

1502-
def_get_inverse_paths_linestyles(self):
1502+
def_get_inverse_paths_linestyle(self):
15031503
"""
15041504
Returns the path and pattern for the gaps in the non-solid lines.
15051505
@@ -1512,7 +1512,7 @@ def _get_inverse_paths_linestyles(self):
15121512
ifls== (0,None)else
15131513
(path,mlines._get_inverse_dash_pattern(*ls))
15141514
for (path,ls)in
1515-
zip(self._paths,itertools.cycle(self._linestyles))]
1515+
zip(self._paths,itertools.cycle(self._linestyle))]
15161516

15171517
returnzip(*path_patterns)
15181518

@@ -1914,7 +1914,7 @@ def draw(self, renderer):
19141914
verts=np.stack((tri.x[triangles],tri.y[triangles]),axis=-1)
19151915

19161916
self.update_scalarmappable()
1917-
colors=self._facecolors[triangles]
1917+
colors=self._facecolor[triangles]
19181918

19191919
gc=renderer.new_gc()
19201920
self._set_gc_clip(gc)
@@ -2179,7 +2179,7 @@ def draw(self, renderer):
21792179
coordinates,offsets,offset_trf,
21802180
# Backends expect flattened rgba arrays (n*m, 4) for fc and ec
21812181
self.get_facecolor().reshape((-1,4)),
2182-
self._antialiased,self.get_edgecolors().reshape((-1,4)))
2182+
self._antialiased,self.get_edgecolor().reshape((-1,4)))
21832183
gc.restore()
21842184
renderer.close_group(self.__class__.__name__)
21852185
self.stale=False

‎lib/matplotlib/legend_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def get_numpoints(self, legend):
407407

408408
def_default_update_prop(self,legend_handle,orig_handle):
409409
lw=orig_handle.get_linewidths()[0]
410-
dashes=orig_handle._us_linestyles[0]
410+
dashes=orig_handle._us_linestyle[0]
411411
color=orig_handle.get_colors()[0]
412412
legend_handle.set_color(color)
413413
legend_handle.set_linestyle(dashes)

‎lib/matplotlib/lines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def __init__(self, xdata, ydata, *,
362362
self.set_solid_capstyle(solid_capstyle)
363363
self.set_solid_joinstyle(solid_joinstyle)
364364

365-
self._linestyles=None
365+
self._linestyle=None
366366
self._drawstyle=None
367367
self._linewidth=linewidth
368368
self._unscaled_dash_pattern= (0,None)# offset, dash

‎lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ def get_edgecolor(self):
633633
# We need this check here to make sure we do not double-apply the depth
634634
# based alpha shading when the edge color is "face" which means the
635635
# edge colour should be identical to the face colour.
636-
ifcbook._str_equal(self._edgecolors,'face'):
636+
ifcbook._str_equal(self._edgecolor,'face'):
637637
returnself.get_facecolor()
638638
returnself._maybe_depth_shade_and_sort_colors(super().get_edgecolor())
639639

@@ -709,7 +709,7 @@ def set_3d_properties(self, zs, zdir):
709709
#
710710
# Grab the current sizes and linewidths to preserve them.
711711
self._sizes3d=self._sizes
712-
self._linewidths3d=np.array(self._linewidths)
712+
self._linewidth3d=np.array(self._linewidth)
713713
xs,ys,zs=self._offsets3d
714714

715715
# Sort the points based on z coordinates
@@ -727,7 +727,7 @@ def set_sizes(self, sizes, dpi=72.0):
727727
defset_linewidth(self,lw):
728728
super().set_linewidth(lw)
729729
ifnotself._in_draw:
730-
self._linewidths3d=np.array(self._linewidths)
730+
self._linewidth3d=np.array(self._linewidth)
731731

732732
defget_depthshade(self):
733733
returnself._depthshade
@@ -763,8 +763,8 @@ def do_3d_projection(self):
763763
iflen(self._sizes3d)>1:
764764
self._sizes=self._sizes3d[z_markers_idx]
765765

766-
iflen(self._linewidths3d)>1:
767-
self._linewidths=self._linewidths3d[z_markers_idx]
766+
iflen(self._linewidth3d)>1:
767+
self._linewidth=self._linewidth3d[z_markers_idx]
768768

769769
PathCollection.set_offsets(self,np.column_stack((vxs,vys)))
770770

@@ -809,7 +809,7 @@ def get_edgecolor(self):
809809
# We need this check here to make sure we do not double-apply the depth
810810
# based alpha shading when the edge color is "face" which means the
811811
# edge colour should be identical to the face colour.
812-
ifcbook._str_equal(self._edgecolors,'face'):
812+
ifcbook._str_equal(self._edgecolor,'face'):
813813
returnself.get_facecolor()
814814
returnself._maybe_depth_shade_and_sort_colors(super().get_edgecolor())
815815

@@ -890,8 +890,8 @@ def __init__(self, verts, *args, zsort='average', shade=False,
890890
891891
Notes
892892
-----
893-
Note that this class does a bit of magic with the_facecolors
894-
and_edgecolors properties.
893+
Note that this class does a bit of magic with the_facecolor
894+
and_edgecolor properties.
895895
"""
896896
ifshade:
897897
normals=_generate_normals(verts)
@@ -1009,9 +1009,9 @@ def do_3d_projection(self):
10091009
# passed in) and sort the 2D version by view depth.
10101010
self.update_scalarmappable()
10111011
ifself._face_is_mapped:
1012-
self._facecolor3d=self._facecolors
1012+
self._facecolor3d=self._facecolor
10131013
ifself._edge_is_mapped:
1014-
self._edgecolor3d=self._edgecolors
1014+
self._edgecolor3d=self._edgecolor
10151015
txs,tys,tzs=proj3d._proj_transform_vec(self._vec,self.axes.M)
10161016
xyzlist= [(txs[sl],tys[sl],tzs[sl])forslinself._segslices]
10171017

@@ -1034,12 +1034,12 @@ def do_3d_projection(self):
10341034
inenumerate(zip(xyzlist,cface,cedge))),
10351035
key=lambdax:x[0],reverse=True)
10361036

1037-
_,segments_2d,self._facecolors2d,self._edgecolors2d,idxs= \
1037+
_,segments_2d,self._facecolor2d,self._edgecolor2d,idxs= \
10381038
zip(*z_segments_2d)
10391039
else:
10401040
segments_2d= []
1041-
self._facecolors2d=np.empty((0,4))
1042-
self._edgecolors2d=np.empty((0,4))
1041+
self._facecolor2d=np.empty((0,4))
1042+
self._edgecolor2d=np.empty((0,4))
10431043
idxs= []
10441044

10451045
ifself._codes3disnotNone:
@@ -1049,7 +1049,7 @@ def do_3d_projection(self):
10491049
PolyCollection.set_verts(self,segments_2d,self._closed)
10501050

10511051
iflen(self._edgecolor3d)!=len(cface):
1052-
self._edgecolors2d=self._edgecolor3d
1052+
self._edgecolor2d=self._edgecolor3d
10531053

10541054
# Return zorder value
10551055
ifself._sort_zposisnotNone:
@@ -1083,27 +1083,27 @@ def set_alpha(self, alpha):
10831083
except (AttributeError,TypeError,IndexError):
10841084
pass
10851085
try:
1086-
self._edgecolors=mcolors.to_rgba_array(
1086+
self._edgecolor=mcolors.to_rgba_array(
10871087
self._edgecolor3d,self._alpha)
10881088
except (AttributeError,TypeError,IndexError):
10891089
pass
10901090
self.stale=True
10911091

10921092
defget_facecolor(self):
10931093
# docstring inherited
1094-
# self._facecolors2d is not initialized until do_3d_projection
1095-
ifnothasattr(self,'_facecolors2d'):
1094+
# self._facecolor2d is not initialized until do_3d_projection
1095+
ifnothasattr(self,'_facecolor2d'):
10961096
self.axes.M=self.axes.get_proj()
10971097
self.do_3d_projection()
1098-
returnnp.asarray(self._facecolors2d)
1098+
returnnp.asarray(self._facecolor2d)
10991099

11001100
defget_edgecolor(self):
11011101
# docstring inherited
1102-
# self._edgecolors2d is not initialized until do_3d_projection
1103-
ifnothasattr(self,'_edgecolors2d'):
1102+
# self._edgecolor2d is not initialized until do_3d_projection
1103+
ifnothasattr(self,'_edgecolor2d'):
11041104
self.axes.M=self.axes.get_proj()
11051105
self.do_3d_projection()
1106-
returnnp.asarray(self._edgecolors2d)
1106+
returnnp.asarray(self._edgecolor2d)
11071107

11081108

11091109
defpoly_collection_2d_to_3d(col,zs=0,zdir='z'):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp