Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c1a3c03

Browse files
authored
Fix tick label wobbling in animated Qt example (#14077)
Fix tick label wobbling in animated Qt example
2 parents 1009c14 + 3d2c220 commit c1a3c03

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/user_interfaces/embedding_in_qt_sgskip.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,15 @@ def __init__(self):
4646

4747
self._dynamic_ax = dynamic_canvas.figure.subplots()
4848
self._timer = dynamic_canvas.new_timer(
49-
100, [(self._update_canvas, (), {})])
49+
50, [(self._update_canvas, (), {})])
5050
self._timer.start()
5151

5252
def _update_canvas(self):
5353
self._dynamic_ax.clear()
5454
t = np.linspace(0, 10, 101)
55+
# Use fixed vertical limits to prevent autoscaling changing the scale
56+
# of the axis.
57+
self._dynamic_ax.set_ylim(-1.1, 1.1)
5558
# Shift the sinusoid as a function of time.
5659
self._dynamic_ax.plot(t, np.sin(t + time.time()))
5760
self._dynamic_ax.figure.canvas.draw()

0 commit comments

Comments
 (0)