Skip to content

Commit 56ae7d3

Browse files
committed
Add whats new for new slider styles
1 parent d35d033 commit 56ae7d3

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
10+
import matplotlib.pyplot as plt
11+
from matplotlib.widgets import Slider
12+
13+
plt.figure(figsize=(4, 2))
14+
ax_old = plt.axes([0.2, 0.65, 0.65, 0.1])
15+
ax_new = plt.axes([0.2, 0.25, 0.65, 0.1])
16+
Slider(ax_new, "New", 0, 1)
17+
18+
ax = ax_old
19+
valmin = 0
20+
valinit = 0.5
21+
ax.set_xlim([0, 1])
22+
ax_old.axvspan(valmin, valinit, 0, 1)
23+
ax.axvline(valinit, 0, 1, color="r", lw=1)
24+
ax.set_xticks([])
25+
ax.set_yticks([])
26+
ax.text(
27+
-0.02,
28+
0.5,
29+
"Old",
30+
transform=ax.transAxes,
31+
verticalalignment="center",
32+
horizontalalignment="right",
33+
)
34+
35+
ax.text(
36+
1.02,
37+
0.5,
38+
"0.5",
39+
transform=ax.transAxes,
40+
verticalalignment="center",
41+
horizontalalignment="left",
42+
)

0 commit comments

Comments
 (0)