Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying matplotlib Plotting Cookbook
  • Table Of Contents Toc
matplotlib Plotting Cookbook

matplotlib Plotting Cookbook

By : Alexandre Devert
3.7 (10)
close
close
matplotlib Plotting Cookbook

matplotlib Plotting Cookbook

3.7 (10)
By: Alexandre Devert

Overview of this book

This book follows a cookbook style approach that puts orthogonal and non-redundant recipes in your hands. Rather than rehashing the user manual, the explanations expose the underlying logic behind Matplotlib. If you are an engineer or scientist who wants to create great visualizations with Python, rather than yet another specialized language, this is the book for you. While there are several very competent plotting packages, Matplotlib is “just” a Python module. Thus, if you know some Python already, you will feel at home from the first steps on. In case you are an application writer, you won't be left out since the integration of Matplolib is covered.
Table of Contents (15 chapters)
close
close
matplotlib Plotting Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1
Index

Integrating a plot to a Tkinter user interface


matplotlib provides rudimentary widgets to build interactive figures. However, those widgets are very rudimentary and do not scale well for anything that needs more than a couple of controllers. A real graphical user interface library is more adapted to creating sophisticated interactions. Fortunately, Python comes with such a library: Tkinter. Tkinter allows you to create some widgets and give them a windows layout. Even better, matplotlib provides a convenient hook to integrate plots to a user interface made with Tkinter. In this recipe, we will be reproducing the previous example, but using Tkinter for the user interface part.

How to do it...

Conveniently, matplotlib provides a special Tkinter widget that we can use to render figures. Updating the figure inside that special widget is done as in the previous recipe. Here are the steps that we need to follow:

  1. We start with the mandatory import directives as follows:

    import numpy as np
    from tkinter...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
matplotlib Plotting Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon