Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8bd6adb

Browse files
committed
expand doc string for handle_style
1 parent dfbee53 commit 8bd6adb

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

lib/matplotlib/widgets.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt=None,
386386
further styling via the *track* attribute.
387387
388388
handle_style : dict
389-
Properties of the slider handle. Supported values are
389+
Properties of the slider handle. Default values are
390390
391391
========= ===== ======= ========================================
392392
Key Value Default Description
@@ -396,6 +396,10 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt=None,
396396
size int 10 The size of the slider handle in points.
397397
========= ===== ======= ========================================
398398
399+
Other values will be transformed as marker{foo} and passed to the
400+
`~.Line2D` constructor. e.g. ``handle_style = {'style'='x'}`` will
401+
result in ``markerstyle = 'x'``.
402+
399403
Notes
400404
-----
401405
Additional kwargs are passed on to ``self.poly`` which is the
@@ -420,8 +424,10 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt=None,
420424
self.val = valinit
421425
self.valinit = valinit
422426

423-
defaults = {'facecolor':'white', 'edgecolor':'.75', 'size':10}
424-
marker_props = {f'marker{k}': v for k, v in {**defaults, **handle_style}}
427+
defaults = {'facecolor': 'white', 'edgecolor': '.75', 'size': 10}
428+
marker_props = {
429+
f'marker{k}': v for k, v in {**defaults, **handle_style}
430+
}
425431

426432
if orientation == 'vertical':
427433
self.track = Rectangle(
@@ -647,7 +653,7 @@ def __init__(
647653
further styling via the *track* attribute.
648654
649655
handle_style : dict
650-
Properties of the slider handles. Supported values are
656+
Properties of the slider handles. Default values are
651657
652658
========= ===== ======= =========================================
653659
Key Value Default Description
@@ -657,6 +663,10 @@ def __init__(
657663
size int 10 The size of the slider handles in points.
658664
========= ===== ======= =========================================
659665
666+
Other values will be transformed as marker{foo} and passed to the
667+
`~.Line2D` constructor. e.g. ``handle_style = {'style'='x'}`` will
668+
result in ``markerstyle = 'x'``.
669+
660670
Notes
661671
-----
662672
Additional kwargs are passed on to ``self.poly`` which is the
@@ -679,13 +689,10 @@ def __init__(
679689
self.val = valinit
680690
self.valinit = valinit
681691

682-
marker_props = {}
683-
defaults = {'facecolor':'white', 'edgecolor':'.75', 'size':10}
684-
if handle_style is not None:
685-
for k in ['facecolor', 'edgecolor', 'size']:
686-
marker_props[f'marker{k}'] = handle_style.get(k, defaults[k])
687-
else:
688-
marker_props = {f'marker{k}': v for k, v in defaults.items()}
692+
defaults = {'facecolor': 'white', 'edgecolor': '.75', 'size': 10}
693+
marker_props = {
694+
f'marker{k}': v for k, v in {**defaults, **handle_style}
695+
}
689696

690697
if orientation == "vertical":
691698
self.track = Rectangle(

0 commit comments

Comments
 (0)