8000 Add whats new for new slider styles · matplotlib/matplotlib@91c2e4e · GitHub
[go: up one dir, main page]

Skip to content

Commit 91c2e4e

Browse files
committed
Add whats new for new slider styles
1 parent d35d033 commit 91c2e4e

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Updated the appearance of Slider widgets
2+
----------------------------------------
3+
4+
The appearance of `~.Slider` and `~.RangeSlider` widgets
5+
were updated and given new styling parameters for the
6+
added handles.
7+
8+
.. plot::
9+
from matplotlib.widgets import Slider
10+
11+
plt.figure(figsize=(4, 2))
12+
ax_old = plt.axes([0.2, 0.65, 0.65, 0.1])
13+
ax_new = plt.axes([0.2, 0.25, 0.65, 0.1])
14+
Slider(ax_new, "New", 0, 1)
15+
16+
ax = ax_old
17+
valmin = 0
18+
valinit = 0.5
19+
ax.set_xlim([0, 1])
20+
ax_old.axvspan(valmin, valinit, 0, 1)
21+
ax.axvline(valinit, 0, 1, color="r", lw=1)
22+
ax.set_xticks([])
23+
ax.set_yticks([])
24+
ax.text(
25+
-0.02,
26+
0.5,
27+
"Old",
28+
transform=ax.transAxes,
29+
verticalalignment="center",
30+
horizontalalignment="right",
31+
)
32+
33+
ax.text(
34+
1.02,
35+
0.5,
36+
"0.5",
37+
transform=ax.transAxes,
38+
verticalalignment="center",
39+
horizontalalignment="left",
40+
)

0 commit comments

Comments
 (0)
0