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 7. Embedding Matplotlib in wxWidgets Using wxPython

This chapter will explain how we can use Matplotlib in the wxWidgets framework, particularly using wxPython bindings.

The contents of this chapter are as follows:

  • A brief introduction to wxWidgets and wxPython
  • A simple example of embedding Matplotlib in wxWidgets
  • Extending the previous example to include the Matplotlib navigation toolbar
  • How to update a Matplotlib plot in real time using the wxWidgets framework
  • How to design a GUI with wxGlade and embed a Matplotlib figure in it

Let's start with an overview of the features of wxWidgets and wxPython.

A brief introduction to wxWidgets and wxPython


One of the most important features of wxWidgets is cross-platform portability; it currently supports Windows, macOS X, Linux (with the X11, Motif, and GTK+ libraries), OS/2, and several other operating systems and platforms (including an embedded version that is currently under development).

wxWidgets can best be described as a native mode toolkit because it provides a thin API abstraction layer across platforms and uses platform-native widgets under the hood, as opposed to emulating them. Using native controls gives wxWidgets applications a natural and familiar look and feel. On the other hand, introducing an additional layer can result in a slight performance penalty, although this is unlikely to be noticed in the kind of applications we will commonly develop.

wxWidgets is not restricted to GUI development. It's more than just a graphics toolkit, providing a whole set of additional facilities, such as database libraries, an inter-process communication...

Summary


We are now able to develop wxWidgets applications and then embed Matplotlib in them. To be specific, readers should be able to embed a Matplotlib figure in a wxFrame, use a sizer to embed both the figure and navigation toolbar in a wxFrame, update a plot through interaction, and use wxGlade to design a GUI for Matplotlib embedding. 

We are now ready to move further and see how to integrate Matplotlib into the web.

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}