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

GUI neutral widgets

This section describes a selection of the different kinds of widgets along with how to add interactivity to these widgets using callbacks.

How to add the basic GUI neutral widgets

We will begin by taking a look at cursor. The cursor will generate a widget that places little x axis and y axis cursors over the top of the axis. The first argument to any widget is the axis that we want to attach it to. In this case, we want to attach it to the current axis. By doing this, by default, it should look unchanged.

  1. However, as we hover over the plot, we get the XY cursor, as shown in the following output after the code:
# Basic cursor
nums = np.arange(0,10,0.1)
plt.plot(nums, np.sin(nums))
Cursor(plt.gca())

Following...

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}