8000 tune slider initline parameters to minimize asymmetry · matplotlib/matplotlib@a7c4df6 · GitHub
[go: up one dir, main page]

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 a7c4df6

Browse files
ianhitimhoffm
andcommitted
tune slider initline parameters to minimize asymmetry
Co-Authored-By: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
1 parent e160db4 commit a7c4df6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/matplotlib/widgets.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt=None,
438438
)
439439
ax.add_patch(self.track)
440440
self.poly = ax.axhspan(valmin, valinit, .25, .75, **kwargs)
441-
self.hline = ax.axhline(valinit, .25, .75, color=initcolor, lw=1)
441+
self.hline = ax.axhline(valinit, .15, .85, color=initcolor, lw=1)
442442
handleXY = [[0.5], [valinit]]
443443
else:
444444
self.track = Rectangle(
@@ -448,7 +448,12 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt=None,
448448
)
449449
ax.add_patch(self.track)
450450
self.poly = ax.axvspan(valmin, valinit, .25, .75, **kwargs)
451-
self.vline = ax.axvline(valinit, .25, .75, color=initcolor, lw=1)
451+
# These asymmetric limits (.2, .9) minimize the asymmetry
452+
# above and below the *poly* when rendered to pixels.
453+
# This seems to be different for Horizontal and Vertical lines.
454+
# For discussion see:
455+
# https://github.com/matplotlib/matplotlib/pull/19265
456+
self.vline = ax.axvline(valinit, .2, .9, color=initcolor, lw=1)
452457
handleXY = [[valinit], [0.5]]
453458
self._handle, = ax.plot(
454459
*handleXY,

0 commit comments

Comments
 (0)
0