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

Commit81236ff

Browse files
committed
Remove unused 'linestyle' property of GraphicsContextBase.
Also simplify linestyle handling by Line2D.
1 parent52e4374 commit81236ff

File tree

7 files changed

+13
-76
lines changed

7 files changed

+13
-76
lines changed

‎doc/api/api_changes/code_removal.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ Moved to ``qt_compat.py``. Renamed because it now handles Qt5 as well.
1515
Deprecated methods
1616
------------------
1717

18-
The ``GraphicsContextBase.set_graylevel``, ``FigureCanvasBase.onHilite`` and
18+
The ``GraphicsContextBase.set_graylevel``,
19+
``GraphicsContextBase.get_linestyle``,
20+
``GraphicsContextBase.set_linestyle``, ``FigureCanvasBase.onHilite`` and
1921
``mpl_toolkits.axes_grid1.mpl_axes.Axes.toggle_axisline`` methods have been
2022
removed.
2123

‎lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
302302
path_ids.append((path,transforms.Affine2D(transform)))
303303

304304
forxo,yo,path_id,gc0,rgbFaceinself._iter_collection(
305-
gc,master_transform,all_transforms,path_ids,offsets,
306-
offsetTrans,facecolors,edgecolors,linewidths,linestyles,
305+
gc,master_transform,all_transforms,path_ids,offsets,
306+
offsetTrans,facecolors,edgecolors,linewidths,linestyles,
307307
antialiaseds,urls,offset_position):
308308
path,transform=path_id
309309
transform=transforms.Affine2D(
@@ -813,7 +813,6 @@ def __init__(self):
813813
self._clippath=None
814814
self._dashes=None,None
815815
self._joinstyle='round'
816-
self._linestyle='solid'
817816
self._linewidth=1
818817
self._rgb= (0.0,0.0,0.0,1.0)
819818
self._hatch=None
@@ -834,7 +833,6 @@ def copy_properties(self, gc):
834833
self._clippath=gc._clippath
835834
self._dashes=gc._dashes
836835
self._joinstyle=gc._joinstyle
837-
self._linestyle=gc._linestyle
838836
self._linewidth=gc._linewidth
839837
self._rgb=gc._rgb
840838
self._hatch=gc._hatch
@@ -912,13 +910,6 @@ def get_joinstyle(self):
912910
"""
913911
returnself._joinstyle
914912

915-
defget_linestyle(self,style):
916-
"""
917-
Return the linestyle: one of ('solid', 'dashed', 'dashdot',
918-
'dotted').
919-
"""
920-
returnself._linestyle
921-
922913
defget_linewidth(self):
923914
"""
924915
Return the line width in points as a scalar
@@ -1062,16 +1053,6 @@ def set_linewidth(self, w):
10621053
"""
10631054
self._linewidth=float(w)
10641055

1065-
defset_linestyle(self,style):
1066-
"""
1067-
Set the linestyle to be one of ('solid', 'dashed', 'dashdot',
1068-
'dotted'). These are defined in the rcParams
1069-
`lines.dashed_pattern`, `lines.dashdot_pattern` and
1070-
`lines.dotted_pattern`. One may also specify customized dash
1071-
styles by providing a tuple of (offset, dash pairs).
1072-
"""
1073-
self._linestyle=style
1074-
10751056
defset_url(self,url):
10761057
"""
10771058
Sets the url for links in compatible backends

‎lib/matplotlib/backends/backend_pdf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,8 +2325,6 @@ def clip_cmd(self, cliprect, clippath):
23252325
(('_hatch',),hatch_cmd),# must come after fillcolor and rgb
23262326
)
23272327

2328-
# TODO: _linestyle
2329-
23302328
defdelta(self,other):
23312329
"""
23322330
Copy properties of other into self and return PDF commands

‎lib/matplotlib/backends/backend_wx.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,6 @@ class GraphicsContextWx(GraphicsContextBase):
409409
'miter':wx.JOIN_MITER,
410410
'round':wx.JOIN_ROUND}
411411

412-
_dashd_wx=wxc.dashd_wx
413-
414412
_cache=weakref.WeakKeyDictionary()
415413

416414
def__init__(self,bitmap,renderer):
@@ -510,26 +508,6 @@ def set_joinstyle(self, js):
510508
self.gfx_ctx.SetPen(self._pen)
511509
self.unselect()
512510

513-
defset_linestyle(self,ls):
514-
"""
515-
Set the line style to be one of
516-
"""
517-
DEBUG_MSG("set_linestyle()",1,self)
518-
self.select()
519-
GraphicsContextBase.set_linestyle(self,ls)
520-
try:
521-
self._style=GraphicsContextWx._dashd_wx[ls]
522-
exceptKeyError:
523-
self._style=wx.LONG_DASH# Style not used elsewhere...
524-
525-
# On MS Windows platform, only line width of 1 allowed for dash lines
526-
ifwx.Platform=='__WXMSW__':
527-
self.set_linewidth(1)
528-
529-
self._pen.SetStyle(self._style)
530-
self.gfx_ctx.SetPen(self._pen)
531-
self.unselect()
532-
533511
defget_wxcolour(self,color):
534512
"""return a wx.Colour from RGB format"""
535513
DEBUG_MSG("get_wx_color()",1,self)

‎lib/matplotlib/lines.py

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -770,11 +770,9 @@ def draw(self, renderer):
770770
renderer=PathEffectRenderer(self.get_path_effects(),renderer)
771771

772772
renderer.open_group('line2d',self.get_gid())
773-
funcname=self._lineStyles.get(self._linestyle,'_draw_nothing')
774-
iffuncname!='_draw_nothing':
773+
ifself._lineStyles[self._linestyle]!='_draw_nothing':
775774
tpath,affine=transf_path.get_transformed_path_and_affine()
776775
iflen(tpath.vertices):
777-
line_func=getattr(self,funcname)
778776
gc=renderer.new_gc()
779777
self._set_gc_clip(gc)
780778

@@ -797,7 +795,8 @@ def draw(self, renderer):
797795
ifself.get_sketch_params()isnotNone:
798796
gc.set_sketch_params(*self.get_sketch_params())
799797

800-
line_func(renderer,gc,tpath,affine.frozen())
798+
gc.set_dashes(self._dashOffset,self._dashSeq)
799+
renderer.draw_path(gc,tpath,affine.frozen())
801800
gc.restore()
802801

803802
ifself._markerandself._markersize>0:
@@ -1242,26 +1241,6 @@ def set_dashes(self, seq):
12421241
else:
12431242
self.set_linestyle((0,seq))
12441243

1245-
def_draw_solid(self,renderer,gc,path,trans):
1246-
gc.set_linestyle('solid')
1247-
gc.set_dashes(self._dashOffset,self._dashSeq)
1248-
renderer.draw_path(gc,path,trans)
1249-
1250-
def_draw_dashed(self,renderer,gc,path,trans):
1251-
gc.set_linestyle('dashed')
1252-
gc.set_dashes(self._dashOffset,self._dashSeq)
1253-
renderer.draw_path(gc,path,trans)
1254-
1255-
def_draw_dash_dot(self,renderer,gc,path,trans):
1256-
gc.set_linestyle('dashdot')
1257-
gc.set_dashes(self._dashOffset,self._dashSeq)
1258-
renderer.draw_path(gc,path,trans)
1259-
1260-
def_draw_dotted(self,renderer,gc,path,trans):
1261-
gc.set_linestyle('dotted')
1262-
gc.set_dashes(self._dashOffset,self._dashSeq)
1263-
renderer.draw_path(gc,path,trans)
1264-
12651244
defupdate_from(self,other):
12661245
"""copy properties from other to self"""
12671246
Artist.update_from(self,other)

‎lib/matplotlib/patheffects.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
354354

355355
gc0.set_foreground(shadow_rgbFace)
356356
gc0.set_alpha(self._alpha)
357-
gc0.set_linestyle("solid")
358357

359358
gc0=self._update_gc(gc0,self._gc)
360359
renderer.draw_path(gc0,tpath,affine0,fill_color)

‎lib/mpl_toolkits/axisartist/axis_artist.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ def draw(self, renderer):
156156
join=self._solidjoinstyle
157157
gc.set_joinstyle(join)
158158
gc.set_capstyle(cap)
159+
gc.set_dashes(self._dashOffset,self._dashSeq)
159160

160-
funcname=self._lineStyles.get(self._linestyle,'_draw_nothing')
161-
iffuncname!='_draw_nothing':
162-
tpath,affine=self._transformed_path.get_transformed_path_and_affine()
163-
lineFunc=getattr(self,funcname)
164-
lineFunc(renderer,gc,tpath,affine.frozen())
161+
ifself._lineStyles.get[self._linestyle]!='_draw_nothing':
162+
tpath,affine= (
163+
self._transformed_path.get_transformed_path_and_affine())
164+
renderer.draw_path(gc,tpath,affine.frozen())
165165

166166
gc.restore()
167167
renderer.close_group('line2d')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp