Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Interactive Applications using Matplotlib

You're reading from   Interactive Applications using Matplotlib

Arrow left icon
Product type Paperback
Published in Mar 2015
Publisher
ISBN-13 9781783988846
Length 174 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Show() your work

With Matplotlib installed, you are now ready to make your first simple plot. Matplotlib has multiple layers. Pylab is the topmost layer, often used for quick one-off plotting from within a live Python session. Start up your favorite Python interpreter and type the following:

>>> from pylab import *
>>> plot([1, 2, 3, 2, 1])

Nothing happened! This is because Matplotlib, by default, will not display anything until you explicitly tell it to do so. The Matplotlib library is often used for automated image generation from within Python scripts, with no need for any interactivity. Also, most users would not be done with their plotting yet and would find it distracting to have a plot come up automatically. When you are ready to see your plot, use the following command:

>>> show()
You have been reading a chapter from
Interactive Applications using Matplotlib
Published in: Mar 2015
Publisher:
ISBN-13: 9781783988846
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 $19.99/month. Cancel anytime
Banner background image