Book Image

Python GUI Programming Cookbook

By : Burkhard Meier
Book Image

Python GUI Programming Cookbook

By: Burkhard Meier

Overview of this book

Table of Contents (18 chapters)
Python GUI Programming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating our first chart


Now that we have all of the required Python modules installed, we can create our own charts using Matplotlib.

We can create charts from only a few lines of Python code.

Getting ready

Using the code from the previous recipe, we can now create a chart that looks similar to the one shown next.

How to do it...

Using the minimum amount of code as presented on the official website, we can create our first chart. Well, almost. The sample code shown on the website does not work until we import the show method and then call it.

We can simplify the code and even improve it by using another of many examples provided on the official Matplotlib website.

How it works...

The Python Matplotlib module, combined with add-ons such as numpy, create a very rich programming environment that enables us to do mathematical computations and plot them in visual charts very easily.

The Python numpy method arange does not intend to arrange anything. It means to create "a range", which in Python is used...