@@ -272,7 +272,8 @@ class Slider(AxesWidget):
272
272
"""
273
273
def __init__ (self , ax , label , valmin , valmax , valinit = 0.5 , valfmt = '%1.2f' ,
274
274
closedmin = True , closedmax = True , slidermin = None ,
275
- slidermax = None , dragging = True , valstep = None , orientation = 'h' , ** kwargs ):
275
+ slidermax = None , dragging = True , valstep = None ,
276
+ orientation = 'horizontal' , ** kwargs ):
276
277
"""
277
278
Parameters
278
279
----------
@@ -314,8 +315,9 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
314
315
valstep : float, optional, default: None
315
316
If given, the slider will snap to multiples of `valstep`.
316
317
317
- orientation : str, optional, default: 'h'
318
- If 'h' the slider is horizontal. If 'v' it is vertical
318
+ orientation : str, optional, default: 'horizontal'
319
+ 'horizontal' : horizontal slider
320
+ 'vertical' : vertical slider
319
321
320
322
Notes
321
323
-----
@@ -332,8 +334,8 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
332
334
if slidermax is not None and not hasattr (slidermax , 'val' ):
333
335
raise ValueError ("Argument slidermax ({}) has no 'val'"
334
336
.format (type (slidermax )))
335
- if orientation not in ['h ' , 'v ' ]:
336
- raise ValueError ("Argument orientation ({}) must be either 'h ' or 'v '"
337
+ if orientation not in ['horizontal ' , 'vertical ' ]:
338
+ raise ValueError ("Argument orientation ({}) must be either 'horizontal ' or 'vertical '"
337
339
.format (orientation ))
338
340
339
341
self .orientation = orientation
@@ -350,7 +352,7 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
350
352
valinit = valmin
351
353
self .val = valinit
352
354
self .valinit = valinit
353
- if orientation is 'v ' :
355
+ if orientation is 'vertical ' :
354
356
self .poly = ax .axhspan (valmin , valinit , 0 , 1 , ** kwargs )
355
357
self .hline = ax .axhline (valinit , 0 , 1 , color = 'r' , lw = 1 )
356
358
else :
@@ -359,7 +361,7 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
359
361
360
362
self .valfmt = valfmt
361
363
ax .set_yticks ([])
362
- if orientation is 'v ' :
364
+ if orientation is 'vertical ' :
363
365
ax .set_ylim ((valmin , valmax ))
364
366
else :
365
367
ax .set_xlim ((valmin , valmax ))
@@ -370,7 +372,7 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
370
372
self .connect_event ('button_release_event' , self ._update )
371
373
if dragging :
372
374
self .connect_event ('motion_notify_event' , self ._update )
373
- if orientation is 'v ' :
375
+ if orientation is 'vertical ' :
374
376
self .label = ax .text (0.5 , 1.02 , label , transform = ax .transAxes ,
375
377
verticalalignment = 'bottom' ,
376
378
horizontalalignment = 'center' )
@@ -441,7 +443,7 @@ def _update(self, event):
441
443
self .drag_active = False
442
444
event .canvas .release_mouse (self .ax )
443
445
return
444
- if self .orientation is 'v ' :
446
+ if self .orientation is 'vertical ' :
445
447
val = self ._value_in_bounds (event .ydata )
446
448
else :
447
449
val = self ._value_in_bounds (event .xdata )
@@ -457,7 +459,7 @@ def set_val(self, val):
457
459
val : float
458
460
"""
459
461
xy = self .poly .xy
460
- if self .orientation is 'v ' :
462
+ if self .orientation is 'vertical ' :
461
463
xy [1 ] = 0 , val
462
464
xy [2 ] = 1 , val
463
465
else :
0 commit comments