Skip to content

Commit cbc4229

Browse files
rcomermeeseeksmachine
authored andcommitted
Backport PR #28739: Tweak interactivity docs wording (and fix capitalization).
1 parent d04b2f6 commit cbc4229

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

galleries/users_explain/figure/event_handling.rst

+9-6
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ is created every time a mouse is pressed::
251251

252252
def __call__(self, event):
253253
print('click', event)
254-
if event.inaxes!=self.line.axes: return
254+
if event.inaxes != self.line.axes:
255+
return
255256
self.xs.append(event.xdata)
256257
self.ys.append(event.ydata)
257258
self.line.set_data(self.xs, self.ys)
@@ -277,17 +278,19 @@ event.ydata)``. In addition to the ``LocationEvent`` attributes, it also has:
277278
Draggable rectangle exercise
278279
----------------------------
279280

280-
Write draggable rectangle class that is initialized with a
281+
Write a draggable rectangle class that is initialized with a
281282
`.Rectangle` instance but will move its ``xy``
282-
location when dragged. Hint: you will need to store the original
283-
``xy`` location of the rectangle which is stored as rect.xy and
283+
location when dragged.
284+
285+
Hint: You will need to store the original
286+
``xy`` location of the rectangle which is stored as ``rect.xy`` and
284287
connect to the press, motion and release mouse events. When the mouse
285288
is pressed, check to see if the click occurs over your rectangle (see
286289
`.Rectangle.contains`) and if it does, store
287-
the rectangle xy and the location of the mouse click in data coords.
290+
the rectangle xy and the location of the mouse click in data coordinates.
288291
In the motion event callback, compute the deltax and deltay of the
289292
mouse movement, and add those deltas to the origin of the rectangle
290-
you stored. The redraw the figure. On the button release event, just
293+
you stored, then redraw the figure. On the button release event, just
291294
reset all the button press data you stored as None.
292295

293296
Here is the solution::

galleries/users_explain/figure/interactive.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Interactive figures
1111
===================
1212

13-
When working with data, interactivity can be invaluable. The pan/zoom and
13+
Interactivity can be invaluable when exploring plots. The pan/zoom and
1414
mouse-location tools built into the Matplotlib GUI windows are often sufficient, but
1515
you can also use the event system to build customized data exploration tools.
1616

galleries/users_explain/figure/interactive_guide.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ which would poll for new data and update the figure at 1Hz.
236236

237237
.. _spin_event_loop:
238238

239-
Explicitly spinning the event Loop
239+
Explicitly spinning the event loop
240240
----------------------------------
241241

242242
.. autosummary::

0 commit comments

Comments
 (0)