@@ -311,7 +311,7 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
311
311
valstep : float, optional, default: None
312
312
If given, the slider will snap to multiples of `valstep`.
313
313
314
- orientation : { 'horizontal', 'vertical'}
314
+ orientation : str, 'horizontal' or 'vertical', default: 'horizontal'
315
315
The orientation of the slider.
316
316
317
317
Notes
@@ -329,7 +329,7 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
329
329
if slidermax is not None and not hasattr (slidermax , 'val' ):
330
330
raise ValueError ("Argument slidermax ({}) has no 'val'"
331
331
.format (type (slidermax )))
332
- if orientation not in { 'horizontal' , 'vertical' } :
332
+ if orientation not in [ 'horizontal' , 'vertical' ] :
333
333
raise ValueError ("Argument orientation ({}) must be either"
334
334
"'horizontal' or 'vertical'" .format (orientation ))
335
335
@@ -347,7 +347,7 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
347
347
valinit = valmin
348
348
self .val = valinit
349
349
self .valinit = valinit
350
- if orientation is 'vertical' :
350
+ if orientation == 'vertical' :
351
351
self .poly = ax .axhspan (valmin , valinit , 0 , 1 , ** kwargs )
352
352
self .hline = ax .axhline (valinit , 0 , 1 , color = 'r' , lw = 1 )
353
353
else :
@@ -356,7 +356,7 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
356
356
357
357
self .valfmt = valfmt
358
358
ax .set_yticks ([])
359
- if orientation is 'vertical' :
359
+ if orientation == 'vertical' :
360
360
ax .set_ylim ((valmin , valmax ))
361
361
else :
362
362
ax .set_xlim ((valmin , valmax ))
@@ -367,7 +367,7 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
367
367
self .connect_event ('button_release_event' , self ._update )
368
368
if dragging :
369
369
self .connect_event ('motion_notify_event' , self ._update )
370
- if orientation is 'vertical' :
370
+ if orientation == 'vertical' :
371
371
self .label = ax .text (0.5 , 1.02 , label , transform = ax .transAxes ,
372
372
verticalalignment = 'bottom' ,
373
373
horizontalalignment = 'center' )
@@ -438,7 +438,7 @@ def _update(self, event):
438
438
self .drag_active = False
439
439
event .canvas .release_mouse (self .ax )
440
440
return
441
- if self .orientation is 'vertical' :
441
+ if self .orientation == 'vertical' :
442
442
val = self ._value_in_bounds (event .ydata )
443
443
else :
444
444
val = self ._value_in_bounds (event .xdata )
@@ -454,7 +454,7 @@ def set_val(self, val):
454
454
val : float
455
455
"""
456
456
xy = self .poly .xy
457
- if self .orientation is 'vertical' :
457
+ if self .orientation == 'vertical' :
458
458
xy [1 ] = 0 , val
459
459
xy [2 ] = 1 , val
460
460
else :
0 commit comments