8000 Changed 'h' and 'v' to 'horizontal' and 'vertical' · matplotlib/matplotlib@0f57e7e · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 0f57e7e

Browse files
Changed 'h' and 'v' to 'horizontal' and 'vertical'
1 parent 7b59aea commit 0f57e7e

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lib/matplotlib/widgets.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ class Slider(AxesWidget):
272272
"""
273273
def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
274274
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):
276277
"""
277278
Parameters
278279
----------
@@ -314,8 +315,9 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
314315
valstep : float, optional, default: None
315316
If given, the slider will snap to multiples of `valstep`.
316317
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
319321
320322
Notes
321323
-----
@@ -332,8 +334,8 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
332334
if slidermax is not None and not hasattr(slidermax, 'val'):
333335
raise ValueError("Argument slidermax ({}) has no 'val'"
334336
.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'"
337339
.format(orientation))
338340

339341
self.orientation = orientation
@@ -350,7 +352,7 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
350352
valinit = valmin
351353
self.val = valinit
352354
self.valinit = valinit
353-
if orientation is 'v':
355+
if orientation is 'vertical':
354356
self.poly = ax.axhspan(valmin, valinit, 0, 1, **kwargs)
355357
self.hline = ax.axhline(valinit, 0, 1, color='r', lw=1)
356358
else:
@@ -359,7 +361,7 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
359361

360362
self.valfmt = valfmt
361363
ax.set_yticks([])
362-
if orientation is 'v':
364+
if orientation is 'vertical':
363365
ax.set_ylim((valmin, valmax))
364366
else:
365367
ax.set_xlim((valmin, valmax))
@@ -370,7 +372,7 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
370372
self.connect_event('button_release_event', self._update)
371373
if dragging:
372374
self.connect_event('motion_notify_event', self._update)
373-
if orientation is 'v':
375+
if orientation is 'vertical':
374376
self.label = ax.text(0.5, 1.02, label, transform=ax.transAxes,
375377
verticalalignment='bottom',
376378
horizontalalignment='center')
@@ -441,7 +443,7 @@ def _update(self, event):
441443
self.drag_active = False
442444
event.canvas.release_mouse(self.ax)
443445
return
444-
if self.orientation is 'v':
446+
if self.orientation is 'vertical':
445447
val = self._value_in_bounds(event.ydata)
446448
else:
447449
val = self._value_in_bounds(event.xdata)
@@ -457,7 +459,7 @@ def set_val(self, val):
457459
val : float
458460
"""
459461
xy = self.poly.xy
460-
if self.orientation is 'v':
462+
if self.orientation is 'vertical':
461463
xy[1] = 0, val
462464
xy[2] = 1, val
463465
else:

0 commit comments

Comments
 (0)
0