Search icon CANCEL
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mastering Matplotlib 2.x

You're reading from  Mastering Matplotlib 2.x

Product type Book
Published in Nov 2018
Publisher Packt
ISBN-13 9781789617696
Pages 214 pages
Edition 1st Edition
Languages
Author (1):
Benjamin Walter Keller Benjamin Walter Keller
Profile icon Benjamin Walter Keller

Event handling with plot callbacks

This section describes how to add interactivity by capturing mouse events along with capturing keyboard clicks.

How to add interactivity by capturing mouse events

Initially, you must import everything that we normally use and use the interactive Notebook backend. Now, the user is not familiar with asynchronous programming with the callback function. This takes in an event, which is then called when that event occurs. The important information of that event is passed as an argument to that function.

We will begin by defining a function called draw_circle (event). These are the events that are passed by Matplotlib callbacks, and they include information about the event. So, in the case of a...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}