Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Matplotlib for Python Developers. - Second Edition

You're reading from  Matplotlib for Python Developers. - Second Edition

Product type Book
Published in Apr 2018
Publisher Packt
ISBN-13 9781788625173
Pages 300 pages
Edition 2nd Edition
Languages
Authors (3):
Aldrin Yim Aldrin Yim
Profile icon Aldrin Yim
Claire Chung Claire Chung
Profile icon Claire Chung
Allen Yu Allen Yu
Profile icon Allen Yu
View More author details

Table of Contents (16) Chapters

Title Page
Dedication
Packt Upsell
Contributors
Preface
Introduction to Matplotlib Getting Started with Matplotlib Decorating Graphs with Plot Styles and Types Advanced Matplotlib Embedding Matplotlib in GTK+3 Embedding Matplotlib in Qt 5 Embedding Matplotlib in wxWidgets Using wxPython Integrating Matplotlib with Web Applications Matplotlib in the Real World Integrating Data Visualization into the Workflow Index

Chapter 5. Embedding Matplotlib in GTK+3

We have worked on quite a few examples so far, and now have a good foundation from which to use Matplotlib to generate data plots and figures. While using Matplotlib alone is very handy in generating interactive figures, experimenting with datasets, and understanding substructures of data, there may be instances where we want an application to acquire, parse, and display our data.

In this chapter, we will study examples on how to embed Matplotlib in applications through GTK+3. 

Installing and setting up GTK+3


Setting up GTK+3 is fairly simple and straightforward. There are quite a few ways to install GTK+3 depending on your OS version and environment.

Note

We encourage our readers refer to the link: https://python-gtk-3-tutorial.readthedocs.io/en/latest/install.html for the latest updates and information on installation.

At the time of writing this book, the official website advises users to install GTK+3 through JHBuild. However, users have experienced a compatibility issue with JHBuild with the macOS El Capitan. 

Note

We recommend macOS users to use the package manager brew to install GTK+3.

GTK+3 can be installed simply if you have brew installed in your macOS:

#Installing the gtk3 packagebrewinstallgtk3#Installing PyGObjectbrewinstallpygobject3

For Linux systems such as Ubuntu, GTK+3 is installed by default. For sophisticated and advanced users who prefer a more customized approach to installing GTK+3, we encourage referring their website to obtain the most recently...

Summary


In this chapter, we have worked through examples on embedding Matplotlib figures inside a simple GTK+3 window, adding the Matplotlib navigation toolbar, plotting data in an interactive framework, and using Glade to design a GUI. We have kept the examples simple to highlight the important parts, but we encourage readers to explore further possibilities. GTK+3 is not the only GUI library that can be used. In the coming chapters, we'll see how to use two other important libraries!

lock icon The rest of the chapter is locked
You have been reading a chapter from
Matplotlib for Python Developers. - Second Edition
Published in: Apr 2018 Publisher: Packt ISBN-13: 9781788625173
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 $15.99/month. Cancel anytime}