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

Appearance settings

Commit e8261cb

Browse filesBrowse files
committed
DOCS: added allowed strings to join/capstyle docs
1 parent e7353a1 commit e8261cb
Copy full SHA for e8261cb

File tree

6 files changed

+20
-115
lines changed
Filter options

6 files changed

+20
-115
lines changed

‎examples/lines_bars_and_markers/joinstyle.py

Copy file name to clipboardExpand all lines: examples/lines_bars_and_markers/joinstyle.py
-90Lines changed: 0 additions & 90 deletions
This file was deleted.

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ def set_capstyle(self, cs):
924924
925925
Parameters
926926
----------
927-
cs : `.CapStyle` or {'butt', 'round', 'projecting'}
927+
cs : {'butt', 'round', 'projecting'} or `.CapStyle`
928928
How to draw end points of lines.
929929
"""
930930
self._capstyle = CapStyle(cs)
@@ -998,7 +998,7 @@ def set_joinstyle(self, js):
998998
999999
Parameters
10001000
----------
1001-
js : `.JoinStyle` or {'miter', 'round', 'bevel'}.
1001+
js : {'miter', 'round', 'bevel'} or `.JoinStyle` .
10021002
"""
10031003
self._joinstyle = JoinStyle(js)
10041004

‎lib/matplotlib/backends/backend_svg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_svg.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ def generate_css(attrib={}):
274274
return ''
275275

276276

277-
_capstyle_d = {'projecting': 'square', 'butt': 'butt', 'round': 'round'}
277+
_capstyle_d = {CapStyle.projecting: 'square', CapStyle.butt: 'butt',
278+
CapStyle.round: 'round'}
278279

279280

280281
class RendererSVG(RendererBase):
@@ -575,7 +576,7 @@ def _get_style_dict(self, gc, rgbFace):
575576
if gc.get_joinstyle() != JoinStyle.round:
576577
attrib['stroke-linejoin'] = gc.get_joinstyle().name
577578
if gc.get_capstyle() != CapStyle.butt:
578-
attrib['stroke-linecap'] = _capstyle_d[gc.get_capstyle().name]
579+
attrib['stroke-linecap'] = _capstyle_d[gc.get_capstyle()]
579580

580581
return attrib
581582

‎lib/matplotlib/collections.py

Copy file name to clipboardExpand all lines: lib/matplotlib/collections.py
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,12 @@ def __init__(self,
111111
where *onoffseq* is an even length tuple of on and off ink lengths
112112
in points. For examples, see
113113
:doc:`/gallery/lines_bars_and_markers/linestyles`.
114-
capstyle : `.CapStyle`-like, default: :rc:`patch.capstyle`
114+
capstyle : str or `.CapStyle`-like, default: :rc:`patch.capstyle`
115115
Style to use for capping lines for all paths in the collection.
116-
joinstyle : `.JoinStyle`-like, default: :rc:`patch.joinstyle`
116+
Allowed strings are {'butt', 'round', 'projecting'}.
117+
joinstyle : str or `.JoinStyle`-like, default: :rc:`patch.joinstyle`
117118
Style to use for joining lines for all paths in the collection.
119+
Allowed strings are {'miter', 'round', 'bevel'}.
118120
antialiaseds : bool or list of bool, default: :rc:`patch.antialiased`
119121
Whether each pach in the collection should be drawn with
120122
antialiasing.
@@ -658,7 +660,7 @@ def set_capstyle(self, cs):
658660
659661
Parameters
660662
----------
661-
cs : `.CapStyle` or {'butt', 'round', 'projecting'}
663+
cs : {'butt', 'round', 'projecting'} or `.CapStyle`
662664
The capstyle.
663665
"""
664666
self._capstyle = CapStyle(cs)
@@ -672,7 +674,7 @@ def set_joinstyle(self, js):
672674
673675
Parameters
674676
----------
675-
js : `.JoinStyle` or {'miter', 'round', 'bevel'}
677+
js :{'miter', 'round', 'bevel'} or `.JoinStyle`
676678
The joinstyle.
677679
"""
678680
self._joinstyle = JoinStyle(js)

‎lib/matplotlib/lines.py

Copy file name to clipboardExpand all lines: lib/matplotlib/lines.py
+7-15Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,10 @@ class Line2D(Artist):
250250
markers = MarkerStyle.markers
251251
filled_markers = MarkerStyle.filled_markers
252252
fillStyles = MarkerStyle.fillstyles
253-
253+
# and these are defined in JoinStyle/CapStyle
254+
validJoin = tuple(js.value for js in JoinStyle)
255+
validCap = tuple(cs.value for cs in CapStyle)
254256
zorder = 2
255-
validCap = ('butt', 'round', 'projecting')
256-
validJoin = ('miter', 'round', 'bevel')
257257

258258
def __str__(self):
259259
if self._label != "":
@@ -1310,7 +1310,7 @@ def set_dash_joinstyle(self, s):
13101310
13111311
Parameters
13121312
----------
1313-
s : `.JoinStyle` or {'miter', 'round', 'bevel'}
1313+
s : {'miter', 'round', 'bevel'} or `.JoinStyle`
13141314
How to join segments of the line that are dashed.
13151315
"""
13161316
js = JoinStyle(s)
@@ -1324,7 +1324,7 @@ def set_solid_joinstyle(self, s):
13241324
13251325
Parameters
13261326
----------
1327-
s : `.JoinStyle` or {'miter', 'round', 'bevel'}
1327+
s : {'miter', 'round', 'bevel'} or `.JoinStyle`
13281328
How to join segments of the line that are solid.
13291329
"""
13301330
js = JoinStyle(s)
@@ -1335,16 +1335,12 @@ def set_solid_joinstyle(self, s):
13351335
def get_dash_joinstyle(self):
13361336
"""
13371337
Return the `.JoinStyle` for dashed lines.
1338-
1339-
See also `~.Line2D.set_dash_joinstyle`.
13401338
"""
13411339
return self._dashjoinstyle
13421340

13431341
def get_solid_joinstyle(self):
13441342
"""
13451343
Return the `.JoinStyle` for solid lines.
1346-
1347-
See also `~.Line2D.set_solid_joinstyle`.
13481344
"""
13491345
return self._solidjoinstyle
13501346

@@ -1354,7 +1350,7 @@ def set_dash_capstyle(self, s):
13541350
13551351
Parameters
13561352
----------
1357-
s : `.CapStyle` or {'butt', 'round', 'projecting'}
1353+
s : {'butt', 'round', 'projecting'} or `.CapStyle`
13581354
How to draw end point when line is dashed.
13591355
"""
13601356
cs = CapStyle(s)
@@ -1368,7 +1364,7 @@ def set_solid_capstyle(self, s):
13681364
13691365
Parameters
13701366
----------
1371-
s : `.CapStyle` or {'butt', 'round', 'projecting'}
1367+
s : {'butt', 'round', 'projecting'} or `.CapStyle`
13721368
How to draw end point when line is solid.
13731369
"""
13741370
cs = CapStyle(s)
@@ -1387,16 +1383,12 @@ def get_dash_capstyle(self):
13871383
def get_solid_capstyle(self):
13881384
"""
13891385
Return the `.CapStyle` for solid lines.
1390-
1391-
See also `~.Line2D.set_solid_capstyle`.
13921386
"""
13931387
return self._solidcapstyle
13941388

13951389
def is_dashed(self):
13961390
"""
13971391
Return whether line has a dashed linestyle.
1398-
1399-
See also `~.Line2D.set_linestyle`.
14001392
"""
14011393
return self._linestyle in ('--', '-.', ':')
14021394

‎lib/matplotlib/patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/patches.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ def set_capstyle(self, s):
461461
462462
Parameters
463463
----------
464-
s : `.CapStyle` or {'butt', 'round', 'projecting'}
464+
s : {'butt', 'round', 'projecting'} or `.CapStyle`
465465
"""
466466
cs = CapStyle(s)
467467
self._capstyle = cs
@@ -477,7 +477,7 @@ def set_joinstyle(self, s):
477477
478478
Parameters
479479
----------
480-
s : `.JoinStyle` or {'miter', 'round', 'bevel'}
480+
s : {'miter', 'round', 'bevel'} or `.JoinStyle`
481481
"""
482482
js = JoinStyle(s)
483483
self._joinstyle = js

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.